Skip to content

Replace links to ephemeral file URLs with relative paths #1887

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 1 commit into from
May 6, 2024

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Apr 19, 2024

What This PR Changes

In addition to the Markdown content source files, this repository hosts non-text files. These are linked to in the content.

The website publishing system hosts these non-text files in paths under the static subfolder of the website (e.g., https://docs.arduino.cc/static/96e7dacc4383cd4a4a928872eca9e3da/ABX00112-step.zip). The path of the published file includes the file's MD5 hash (e.g., 96e7dacc4383cd4a4a928872eca9e3da). This means that the URL will change every time the file is modified. For this reason, hardcoding links to these URLs in the content should be avoided whenever possible.

The website generation system automatically replaces links to relative paths with the equivalent ephemeral URL under the static subfolder of the website. This means that a link to the relative path of the file is functionally equivalent to linking the hardcoded ephemeral URL.

Although a relative path link is still prone to breakage if the content or target file is moved to a different location in the repository, this will probably occur less frequently than modifications to the files, making the relative path approach superior to the alternative of hardcoding the ephemeral URL.

Contribution Guidelines

Additional Context

This proposal addresses the concern raised at #1881 (comment). An alternative solution is described at #1881 (comment).

In addition to the Markdown content source files, this repository hosts non-text files. These are linked to in the
content.

The website publishing system hosts these non-text files in paths under the `static` subfolder of the website. The path
of the published file includes the file's MD5 hash. This means that the URL will change every time the file is modified.
For this reason, hardcoding links to these URLs in the content should be avoided whenever possible.

The website generation system automatically replaces links to relative paths with the equivalent ephemeral URL under the
`static` subfolder of the website. This means that a link to the relative path of the file is functionally equivalent to
linking the hardcoded ephemeral URL.

Although a relative path link is still prone to breakage if the content or target file is moved to a different location
in the repository, this will probably occur less frequently than modifications to the files, making the relative path
approach superior to the alternative of hardcoding the ephemeral URL.
@per1234 per1234 added enhancement New feature or request arduino Bugs and fixes added by the Arduino Team labels Apr 19, 2024
@jhansson-ard
Copy link
Contributor

jhansson-ard commented Apr 19, 2024

Hey @per1234!

I've added a task to the backlog to include the STEP files into the "static resource URL" system. Until that point, it's fine for me to implement your changes - but this is up to @jcarolinares and his team since they are responsible over the content itself (since this PR is concerning Pro product line) 👍🏼

@per1234 per1234 mentioned this pull request Apr 19, 2024
1 task
@jcarolinares
Copy link
Contributor

Hey @per1234!

I've added a task to the backlog to include the STEP files into the "static resource URL" system. Until that point, it's fine for me to implement your changes - but this is up to @jcarolinares and his team since they are responsible over the content itself (since this PR is concerning Pro product line) 👍🏼

Yes, please proceed, Jacob will take care of the merge

@jcarolinares
Copy link
Contributor

Taking a look at this @jhansson-ard and @per1234

These changes are not going to work until we have the relative paths for step files implemented, so I suggest to keep this pull request as a draft until then. Now it will only break even more the links.

Thanks!

Copy link
Contributor

@jcarolinares jcarolinares left a comment

Choose a reason for hiding this comment

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

Taking a look at this @jhansson-ard and @per1234

These changes are not going to work until we have the relative paths for step files implemented, so I suggest to keep this pull request as a draft until then. Now it will only break even more the links.

Thanks!

@per1234
Copy link
Contributor Author

per1234 commented May 3, 2024

These changes are not going to work until we have the relative paths for step files implemented

@jcarolinares how did you determine that it doesn't work? I verified this pull request by serving the website locally with the changes proposed here and the website generation system automatically replaces the relative path with the static file path just as I described:

image

And those links work perfectly to download the files.

@jcarolinares
Copy link
Contributor

These changes are not going to work until we have the relative paths for step files implemented

@jcarolinares how did you determine that it doesn't work? I verified this pull request by serving the website locally with the changes proposed here and the website generation system automatically replaces the relative path with the static file path just as I described:

image

And those links work perfectly to download the files.

That is a good point but I don't trust in local preview, there are technical differences between the local rendering and the cloud one.

Let's wait for @jhansson-ard confirmation then about that we can proceed, I prefer to wait until Monday than work twice, thank you both!

@jhansson-ard
Copy link
Contributor

jhansson-ard commented May 6, 2024

@per1234 @jcarolinares We can try this on the staging platform as well to ensure it will work in production, please use the workflow in the #prj_docs_deploy channel if you want to try it 🙏🏼

Copy link
Contributor

@jcarolinares jcarolinares left a comment

Choose a reason for hiding this comment

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

Confirmed by @jhansson-ard is working

Approved

Thanks!

@per1234 per1234 merged commit 98252cf into main May 6, 2024
4 of 5 checks passed
@per1234 per1234 deleted the per1234/use-relative-links branch May 6, 2024 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arduino Bugs and fixes added by the Arduino Team enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants