Random little pelican problem if anyone can help me.
I am writing a theme which is structures like this.
├── static
│ ├── css
│ ├── js
│ └── img
└── templates
├── index.html
└── page.html
In the index.html file I'm using this to call the static css, img and js files
<link rel="stylesheet" href="theme/css/base.css"/>
For the page.html I then 'extend' the base.html with this line
{% extends "index.html" %}
When I generate the html in to the output folder all works fine for the index.html but the page.html can't find the static files as it will need a new path. This is the output folder setup.
├── theme
| ├── css
│ ├── js
│ └── img
├── index.html
└── pages
└── page.html
If you see the page.html can't load the css by using the path theme/css/base.css
Is there a way to use a {{ ROUTE }} command when loading static files?
Thanks!
Edit 1 After looking at some other theme's index.html page on Github I see they use the {{ SITEURL }} tag but that doesn't work for me.
<link rel="stylesheet" href="{{ SITEURL }}theme/css/base.css"/>
Edit 2 I've fixed this by using the following line in the pelicanconf.py file
RELATIVE_URLS = True
and the following in index.html
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/base.css"/>
I had the same issue when developing locally and was able to resolve it by setting SITEURL = '.'
.
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