I am creating a static site with Pelican and I'm confused about how to add a favicon to it.
I've seen in the documentation that:
You can also use the
EXTRA_PATH_METADATA
mechanism to place afavicon.ico
orrobots.txt
at the root of any site.
I don't know where to put my favicon.ico
file and what to specify in the EXTRA_PATH_METADATA
setting (if this is really the setting that should be used).
In my pelicanconf.py
, I have:
STATIC_PATHS = [
'images',
'extra', # this
]
EXTRA_PATH_METADATA = {
'extra/custom.css': {'path': 'custom.css'},
'extra/robots.txt': {'path': 'robots.txt'},
'extra/favicon.ico': {'path': 'favicon.ico'}, # and this
'extra/CNAME': {'path': 'CNAME'},
'extra/LICENSE': {'path': 'LICENSE'},
'extra/README': {'path': 'README'},
}
The structure for these extra files is then:
/content
/extra
favicon.ico
robots.txt
See the documentation, which shows a similar layout.
The official way @jonrsharpe described doesn't work for my page. I don't know why, it should.
I decided to put the favicon.ico
in the image
folder and to insert a link in base.html
to get it work:
<link rel="shortcut icon" href="{{ SITEURL }}/images/favicon.ico?v=2" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With