Reputation: 739
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.
Upvotes: 9
Views: 1793
Reputation: 25331
The accepted answer helped me, but this comment wasn't necessary IF you want the static HTML rendered
Here's snippet from pelicanconf.py
that is working for me, which adds a static site based on the html file located at content/html/page_name.html
with this path http://localhost/page_name.html
STATIC_PATHS = [
'images',
'extra',
'html',
]
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'},
'html/page_name.html' : {'path' : 'page_name.html'}
}
Upvotes: 0
Reputation: 122036
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.
Upvotes: 11
Reputation: 59
There's a couple solutions to these issues. First, for the site verification. You can either just manually add the verification file when you push the generated content out, or add a <meta>
tag to the site template. You can read more about your options here: https://support.google.com/webmasters/answer/35179?hl=en
As for embedding HTML into a pelican site, you can use reStructuredText (.rst) instead of Markdown (.md) and then you can import the html. Explanation here on reddit.
Upvotes: -1