Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hosting raw HTML pages in a Pelican static website

Is there a way in Pelican (Python) static site generator to pass in just a raw HTML page only? At the moment I am trying to place a google-site-verification HTML file to be permanent hosted in the root directory. I have run into this issue a few other times, unrelated to the google site verification.

In an ideal world I would place the HTML file in the content directory, like an rst or an md file, and then it is picked up and dropped into the output directory. This is obviously not working, hence why I am here.

like image 756
Douglas Kastle Avatar asked May 26 '17 19:05

Douglas Kastle


1 Answers

The simplest way to include arbitrary files in the output is with EXTRA_PATH_METADATA and STATIC_PATHS. For example, from my blog's config:

STATIC_PATHS = [
    'images',
    'extra',
]
EXTRA_PATH_METADATA = {
    'extra/custom.css': {'path': 'custom.css'},
    'extra/robots.txt': {'path': 'robots.txt'},
    'extra/favicon.ico': {'path': 'favicon.ico'},
    'extra/CNAME': {'path': 'CNAME'},
    'extra/LICENSE': {'path': 'LICENSE'},
    'extra/README': {'path': 'README'},
}

This takes the specified files from /content/extra and puts them in the root of /output.

As you have an HTML file in your extras, you will also need to include your static directory in ARTICLE_EXCLUDES to prevent Pelican from trying to process the file.

like image 83
jonrsharpe Avatar answered Sep 22 '22 13:09

jonrsharpe