Replies: 2 comments 1 reply
-
Argh. You're right, I missed that in the overhaul effort and it's still only usable within the legacy engine config. I'll review what's going on there and even if there's a better type of tag that's more universal and not just for "posts" — we're really trying to get away from any functionality that's strictly about posts and instead support any number of collections (posts just happening to be a default choice). |
Beta Was this translation helpful? Give feedback.
-
FWIW, I ran into the same on trying to convert. What's below is a "workaround" custom builder that solved things in my case: class PostLink < SiteBuilder
def build
liquid_tag 'post_url', :post_link
end
def all_posts
@all_posts ||= site.collections.posts.resources
end
def matching_post(url)
all_posts.find do |post|
post.relative_path.to_s == url
end
end
def standardize_url(url)
'_posts/' + url + '.md'
end
def post_link(url, tag)
match = matching_post standardize_url(url)
return match.relative_url if match
raise Bridgetown::Errors::PostURLError, "#{url} was not found for linking"
end
end This makes some big assumptions that may not apply for your repo, but might be a good starting point. Assumptions:
Also, I've currently got it redirecting to the 404 page, but it'd probably be better to flag broken links by throwing an error instead. |
Beta Was this translation helpful? Give feedback.
-
Hey! Recently I finished migrating my blog from Jekyll to Bridgetown. So far it's been a great journey. Now I wanted to make it future-proof by switching to resource engine but it stopped working on rendering
post_url
tags:I've tried hacking around the tag
Bridgetown::Tags::PostUrl
class to fix it but without much success. I wonder if there is an "official" way to do it. I may, of course, rewrite allpost_url
s to something else but I worry that it would discourage some people from migrating fro Jekyll in the future.Beta Was this translation helpful? Give feedback.
All reactions