Skip to content

Use relative urls everywhere. #967

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

Merged
merged 2 commits into from
May 31, 2022
Merged

Conversation

m-ou-se
Copy link
Member

@m-ou-se m-ou-se commented Apr 20, 2022

This makes it work to just open site/index.html in a browser locally without having tot spin up a web server.

m-ou-se added 2 commits April 20, 2022 18:14
Since all urls are now relative, you can just open site/index.html
directly without having to spawn a web server.
@m-ou-se m-ou-se requested a review from a team April 20, 2022 16:18
@m-ou-se
Copy link
Member Author

m-ou-se commented May 19, 2022

@pietroalbini - Are you the right person to review this?

Copy link
Member

@Mark-Simulacrum Mark-Simulacrum left a comment

Choose a reason for hiding this comment

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

This broadly looks okay, but I'd like to hold off on merging away from a release day (since we're likely to have heavier than typical traffic today) in case there's any problems.

Copy link
Member

@rylev rylev left a comment

Choose a reason for hiding this comment

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

Love the idea! Looks like images that are embedded through the markdown don't work.

image

@m-ou-se
Copy link
Member Author

m-ou-se commented May 25, 2022

Those urls seem to be hardcoded in the posts themselves:

<img src="/images/2016-08-09-Errors/new_errors.png" width="500" />

[old_errors]: /images/2016-08-09-Errors/old_errors.png
[new_errors]: /images/2016-08-09-Errors/new_errors.png
[new_errors2]: /images/2016-08-09-Errors/new_errors2.png
[new_errors3]: /images/2016-08-09-Errors/new_errors3.png
[new_errors4]: /images/2016-08-09-Errors/new_errors4.png

They will still work on the website. This PR doesn't change that.

@rylev
Copy link
Member

rylev commented May 25, 2022

That's fine. I just think this means that there is still a reason to use a web server locally (albeit a small one), and so we should probably reference that in the README by saying that the use of the web server is optional and most everything will work without it.

Copy link
Member

@rylev rylev left a comment

Choose a reason for hiding this comment

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

Marking this as approved because I don't want to block. I still think that the readme should continue to mention using the webserver as an optional way to view the blog locally since there are things that won't work when opening files directly in the browser.

@pietroalbini pietroalbini merged commit 7b56103 into rust-lang:master May 31, 2022
@m-ou-se m-ou-se deleted the relative-urls branch June 1, 2022 11:57
@m-ou-se
Copy link
Member Author

m-ou-se commented Jun 1, 2022

It seems like comrak doesn't have an option to transform urls, but we can just change all the urls in the blog posts to relative ones manually.

@m-ou-se
Copy link
Member Author

m-ou-se commented Jun 1, 2022

Another option would be to generate a <base href="../../../"> tag for every page, and just remove the leading slash on all the absolute urls. It'd affect all relative urls though, so there's a slightly higher chance of accidentally breaking something.

@m-ou-se
Copy link
Member Author

m-ou-se commented Jun 1, 2022

See #980

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants