Closed semente closed 2 years ago
Thanks for bringing this up @semente, and thanks for the insight on both providing direct access to the post's fully baked URL but also to notice that we currently don't have an edge between the post and its route, though we already support the opposite edge. I think both points should be addressed.
The only thing that I'd suggest changing in your proposal is that maybe I'd keep post.url
and introduce something like post.full_url
(please chime in on the name if you think this is a good idea). the way it is for two reasons:
What do you think?
- we get to keep backward compatibility
hmm but do we already have a post.url
? I couldn't use this in templates... Or I didn't understand why it would make a backward compatibility.
Anyway I'm fine in using another name. Perhaps absolute_url
? full_url
looks good too.
- we get to keep backward compatibility
hmm but do we already have a
post.url
? I couldn't use this in templates... Or I didn't understand why it would make a backward compatibility.Anyway I'm fine in using another name. Perhaps
absolute_url
?full_url
looks good too.
I have no idea why I thought we had anything in post.url
I guess I made that up. I guess we should go with that name. Sorry about the confusion here.
I just pushed a commit with the feature implemented. I didn't really close the ticket because I didn't really document it yet! Anyway, let me know if you have any feedback on it 😄 Thank you for opening this issue with such a cool idea 🙇🏾
opa @clarete, looks like this is not working. I get an undefined
value instead the URL.
opa! Thanks for testing it out, @semente!!! I'll take another stab at it!
hi hi hello @semente 👋🏾 finally got to take another look at this issue and I'm now using this feature in weblorg's website itself! So if it breaks it will probably be more visible to me 😅
Please feel free to either reopen this issue or to open a new one if this doesn't work as expected and once again, thanks for both the suggestion and for all the time taken testing this out! 🙇🏾
@clarete was testing this today and it worked partially. Post objects from weblorg-input-aggregate-all-desc
's posts
list returns the current page URL instead object's URL.
post.html:
{{ post.url }} <- this works!
posts.html:
{% for post in posts %}
{{ post.url }} <- this returns current page URL instead post's URL
{% endfor %}
routes:
(weblorg-route
:name "log"
:input-pattern "log/*.org"
:template "post.html"
:output ".output/log/{{ file_slug }}.html"
:url "/log/{{ file_slug }}.html")
(weblorg-route
:name "log/"
:input-pattern "log/*.org"
:input-aggregate #'weblorg-input-aggregate-all-desc
:template "posts.html"
:output ".output/log/index.html"
:url "/log/")
I have multiple directories containing posts and I want to be able to generate a RSS feed for the posts of all these directories, and not just individually. And I could achieve this using the following route:
The problem is that I can't set a proper
item.link
oritem.guid
for the RSS entry because it can't guess what is the route of some post.url_for
requires a route name and I can't do something like<link>{{ url_for(post.route.name, slug=post.slug) }}</link>
.So I propose a
post.url
attribute to make this possible. It will also help those who want to reuse afeed.xml
template between different "posts directories".(by the way, would be interesting to support
post.route.name
as well)