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

Fix url on whitepaper page to properly access whitepaper pdf [fixes #11918] #11928

Merged
merged 6 commits into from
Feb 2, 2024

Conversation

lucas-amberg
Copy link
Contributor

Description

Altered the URL on the whitepaper page to to access the PDF directly

Related Issue

fixes #11918

Copy link

netlify bot commented Jan 14, 2024

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 1febe24
🔍 Latest deploy log https://app.netlify.com/sites/ethereumorg/deploys/65bba69144fd8700088ab095
😎 Deploy Preview https://deploy-preview-11928--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added the content 🖋️ This involves copy additions or edits label Jan 14, 2024
@lucas-amberg
Copy link
Contributor Author

This didn't fix it at all

@lucas-amberg
Copy link
Contributor Author

I've spent a couple hours running around in circles trying to figure this out the best answer I've got is that its related to the locale URLs for the website, if you remove /en/ from the url you can access the PDF with no issue (https://ethereum.org/content/whitepaper/whitepaper-pdf/Ethereum_Whitepaper_-_Buterin_2014.pdf) vs (https://ethereum.org/en/content/whitepaper/whitepaper-pdf/Ethereum_Whitepaper_-_Buterin_2014.pdf). I'll maybe try again to fix this tomorrow but I can't figure it out at the moment

@lucas-amberg
Copy link
Contributor Author

I'd also like to note that in the current dev branch of this repo this issue is non existent in the dev build (yarn dev) even with the locale path so I would assume that it has to do with the way Next.js is bundling the public folder when it is built for production

Copy link
Contributor

@TylerAPfledderer TylerAPfledderer left a comment

Choose a reason for hiding this comment

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

Hey @lucas-amberg!

Just one tiny change right now, but the main issue still stands.

@pettinarip to amend the above comments made by @lucas-amberg: I believe this has to do with how NextJS is interpreting the URL. If I were to move the pdf file to the assets folder, change the link in question to /assets/Ethereum_Whitepaper_-_Buterin_2014.pdf, and remove the isInternalPdf check in the Link component then the loading of the file works as expected.

Because we are using the content folder as an entry point for markdown files to be used as pages, Next is assuming the link in question is also just another page.

I do not have a solution at this time aside from moving the pdf to another folder like assets. Creating a redirect in a middleware file wasn't working when I tried it.

public/content/whitepaper/index.md Outdated Show resolved Hide resolved
@TylerAPfledderer
Copy link
Contributor

@wackerow @pettinarip with the new change to the link the 404 still occurs here if a language code exists in the URL. Tried Arabic with ar.

I still think Next is interpreting the link as a page because of the language code existing in URL, and can't recognize it as an asset link. (In other words, there are no folders in the public directory that have the language codes as their name, so Next skips the asset check, however it does that!)

@corwintines corwintines self-assigned this Jan 24, 2024
@pettinarip
Copy link
Member

pettinarip commented Feb 1, 2024

Thanks for the PR @lucas-amberg

@TylerAPfledderer hmm interesting point. However, I don't see how this is happening. We specify all possible slugs in getStaticPaths with fallback: false, so anything else will throw a 404. There must be something missing with i18n since the problem occurs when the locale prefix is in the path.

Meanwhile, I'm disabling the locale prefix with locale={false} for internal pdf links. This should work for now since we only have one pdf (the whitepaper). We should implement something more robust to support translated pdfs as we do with images.

@TylerAPfledderer
Copy link
Contributor

Thanks for the PR @lucas-amberg

@TylerAPfledderer hmm interesting point. However, I don't see how this is happening. We specify all possible slugs in getStaticPaths with fallback: false, so anything else will throw a 404. There must be something missing with i18n since the problem occurs when the locale prefix is in the path.

Meanwhile, I'm disabling the locale prefix with locale={false} for internal pdf links. This should work for now since we only have one pdf (the whitepaper). We should implement something more robust to support translated pdfs as we do with images.

Agreed. I haven't dug further into this yet.

Copy link
Member

@nhsz nhsz left a comment

Choose a reason for hiding this comment

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

LGTM

@nhsz nhsz self-requested a review February 1, 2024 17:21
@nhsz nhsz merged commit aecb21d into ethereum:dev Feb 2, 2024
10 checks passed
Copy link

gitpoap-bot bot commented Feb 2, 2024

Congrats, your important contribution to this open-source project has earned you a GitPOAP!

Be sure to join the Ethereum.org discord if you are interested in contributing further to the project or have any questions for the team.

GitPOAP: 2024 Ethereum.org Contributor:

GitPOAP: 2024 Ethereum.org Contributor GitPOAP Badge

Head to gitpoap.io & connect your GitHub account to mint!

Learn more about GitPOAPs here.

This was referenced Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content 🖋️ This involves copy additions or edits
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug report
6 participants