Pelican can't find custom static files

251 Views Asked by At

When I load my pelican site, no custom style appears (I double-checked by inspecting), and the icon doesn't display either.

The following error messages show when I run make serve or make serve-global:

           WARNING  Unable to find `/static/custom.css` or variations:                                                                                                       log.py:91
                    /static/custom.css.html                                                                                                                                           
                    /static/custom.css/index.html                                                                                                                                     
                    /static/custom.css                                                                                                                                                
           WARNING  Unable to find `/favicon.ico` or variations:                                                                                                             log.py:91
                    /favicon.ico.html                                                                                                                                                 
                    /favicon.ico/index.html                                                                                                                                           
                    /favicon.ico 

I made sure that the icon and the CSS file are present in the content directory. I have tried moving them to the root directory of the website, which didn't help.

I have also tried moving them to the output directory, which was a successful workaround. It doesn't really solve the problem though, since that directory should be automatically generated (and it probably wouldn't help at all if I tried to publish the site).

If it matters, I use the pelican-twitchy theme and have set CUSTOM_CSS = 'static/custom.css' in the pelicanconf.py file.

1

There are 1 best solutions below

0
s-jevtic On

The path where the custom CSS file is, must be in the STATIC_PATHS array in the pelicanconf.py file. That way, anything in that directory will be copied to the output directory.

Same applies to favicon.ico.

Therefore, the STATIC_PATHS array has to contain at least 'static' and 'favicon.ico'.