How to add a favicon to a Pelican blog?
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.
I used the technique outlined on the Pelican Wiki: https://github.com/getpelican/pelican/wiki/Tips-n-Tricks#copying-faviconrobotstxt
Repeating here in case that page disappears:
- create a directory beside your
content
dir, and put all your favicon items there. - in your
Makefile
, addif test -d $(BASEDIR)/extra; then cp $(BASEDIR)/extra/* $(OUTPUTDIR)/; fi
to any spots that build the site (expublish
,html
, etc)
Now when you build the site, everything in extra/
will get copied to the root of /output
.