Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Shock] - Added Jinja filter called 'pathRelativeToPage' to build URLs on top of page URL (Relates to #164) #165

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

matthew-carroll
Copy link
Contributor

[Shock] - Added Jinja filter called 'pathRelativeToPage' to build URLs on top of page URL (Relates to #164)

This PR doesn't actually resolve #164. When I worked on the problem, I found that the Page url property was giving us just the path, e.g., /posts/my-post/. We don't have any official access to the root domain, so there's no way to solve #164 without first deciding where the domain name should officially live. I didn't want to tackle that right at this moment.

With this approach, assuming a website defines it's own data property called homepage_url, a URL can be built as follows:

{{ homepage_url }}{{ "images/photo.png" | pathRelativeToPage }}

We should still make this much easier in the future, but this is enough to unblock some other work.

@matthew-carroll matthew-carroll merged commit a3cfb31 into main Aug 5, 2024
6 checks passed
@matthew-carroll matthew-carroll deleted the 164_add-jinja-filters-to-create-urls branch August 5, 2024 05:20
@matthew-carroll matthew-carroll restored the 164_add-jinja-filters-to-create-urls branch August 12, 2024 07:01
@matthew-carroll matthew-carroll deleted the 164_add-jinja-filters-to-create-urls branch August 15, 2024 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Shock] - Add jinja filters to generate absolute and relative URLs based on the current page
1 participant