Closed nickpegg closed 6 years ago
Also need tags for:
Page and Post have been fixed by the url()
method on those objects in #22.
For the static stuff, since template tags seem really annoying to implement, it's probably easier just to pass a function to the template, so that users can do something like
<img src="{{ static_url('img/picture.jpg') }}" />
Otherwise, the site can have the base URL attached to it, allowing for
<img src="{{ site['base_url'] }}img/picture.jpg" />
though that's a bit cumbersome compared to static_url()
.
What about other static site generators? Jekyll uses template filters for this (see relative_url
and absolute_url
):
https://jekyllrb.com/docs/templates/
I like this idea. Could be similar to the above static_url
function, just made into a filter:
<img src="{{ 'img/picture.jpg' | static_url }}" />
Completed as part of #24
Right now linking to other pages or static files is tricky: you have to understand where the rendered file and target will both end up and set up your links appropriately.
Posty should keep track of where files will end up and have a
link
template tag that takes a post name or slug or something and inserts the proper URL.Likewise for static content too, maybe a separate
link_static
tag for that which requires the full relative path to the static file under a_static
dir