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

Use relative uris for posts. #71

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/layouts/BlogPosts.astro
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const {
posts.map((post) => (
<PostCard
variant="large"
url={`${BLOG_URL}${post.url}`}
url={post.url}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check that post.url correctly resolves to an absolute url so we don't have inexistant relative urls?

Copy link
Contributor Author

@evert evert Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it's a relative URL, and that's what you want here I think!

But it does resolve and made clicking through the site while testing a lot easier.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern is that we have relative URLs like: ./2024/10/some-post and that will break some pages like the tags pages. For example, if you go to /tags/web-development and have the relative URL post, it will not work as expected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no, the URLs start with a slash! So that should be good

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked, the urls don't start with slashes... 😕

a screenshot of a terminal logging urls, showing all of them start with a number like 2024..., etc.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is an example of an url on the tags page:

url showing: https://localhost:3000/tags/2024/09/new-blog

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof sorry, I must have looked at this wrong. Will fix this PR!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for checking

Copy link
Collaborator

@madcampos madcampos Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, I just fixed the issue on the root. Take a look at this branch: relative-uris...fix/post-urls

It also fixes the issues with the rss feed (turns out it was missing a namespace and the reference to get the posts was wrong)

title={post.data.title}
createdAt={post.data.createdAt.toISOString()}
image={post.data.image}
Expand Down