Comments (7)
@kamuik16 I think you're right.
The bug looks like it was introduced in this commit during the migration from Gatsby to NextJS.
For context, our English links before the migration had the en
prefix (e.g., https://ethereum.org/en/
), but during the migration, we removed them for English but kept them in all other languages (e.g., https://ethereum.org
for English, https://ethereum.org/fr/
for French).
In this PR (which was merged yesterday, and will go live soon), we re-added the en
prefix for English, so this bug is now also present in English (see deploy preview from that PR: https://deploy-preview-12134--ethereumorg.netlify.app/en/assets/).
To solve this, I think we need to add the lang prefix to the src in the AssetDownloadImage
component.
cc: @pettinarip @wackerow
from ethereum-org-website.
I think the problem here is the path definition.
When English is selected as a language the path to any svg i.e. is https://ethereum.org/assets/svgs/eth-diamond-glyph.svg
while if any other language is selected the svg's path link adds the language abbreviation in it.
For e.g. for French it becomes https://ethereum.org/fr/assets/svgs/eth-diamond-glyph.svg
and for Italian it becomes https://ethereum.org/it/assets/svgs/eth-diamond-glyph.svg
. Notice fr
and it
gets added in the link. This problem is with all the svg links on the page.
I looked around but couldn't figure it out how to solve this.
from ethereum-org-website.
@minimalsm May I be assigned this issue?
from ethereum-org-website.
Hey @FaybianB thanks for offering to help!
Sure, all yours :)!
from ethereum-org-website.
The scope of this seems to include all image files, not just SVGs.
This setting seems to be the root cause of the issue because it adds the language prefix to the src urls for the images as well:
https://github.com/ethereum/ethereum-org-website/blob/dev/next-i18next.config.js#L14
I haven't found the exact location that's prepending the language to the image's href but that's what's happening.
We need to remove this language prefix from the href. I think this is happening within the next-i18next framework.
My approach right now is going to be to hack this middleware.ts
function to include a fix to the href:
https://github.com/ethereum/ethereum-org-website/blob/dev/src/middleware.ts#L28
from ethereum-org-website.
@kamuik16 I think you're right.
The bug looks like it was introduced in this commit during the migration from Gatsby to NextJS.
The thing I see changed here is we're using a StaticImageData
for our image... this is when we import an image as a component (ie. import SomeImage from "./some/path"
)... we then use const imgSrc = (image as StaticImageData).src
inside AssetDownload
to get the "source path"... but this is not an accessible path for downloading the image (both png's or svg's).
To get a "source path" that links to a downloadable image we may need to manually add this as a string prop for AssetDownload
... ie:
import learnHero from "@/public/heroes/learn-hub-hero.png"
// ...
<AssetDownload
title={t("page-assets-learn-hero-name")}
alt={t("page-assets-learn-hero-name")}
image={learnHero}
imgSrc="./heroes/learn-hub-hero.png"
artistName="Liam Cobb"
artistUrl="https://liamcobb.com/"
/>
...and then update AssetDownload
to accept this prop and use it for the link href
@FaybianB Does that make sense? Using the .src
property of a statically imported an image will break inside an href
, but a string relative to the public
directory should be available at https://ethereum.org/path/file.ext
(for example, http://ethereum.org/heroes/learn-hub-hero.png)
from ethereum-org-website.
@pettinarip Not sure if you have a better suggestion here aside from just manually adding the src path string (relative to public) as a prop for AssetDownload
from ethereum-org-website.
Related Issues (20)
- UI Bug report: missing padding on stablecoins page HOT 2
- [RFC] Improve Variability of Storybook Snapshots with Modes HOT 6
- Feature request: General ether issuance page HOT 1
- Find wallet filters that do not update when locale changes HOT 1
- Typo, missing spaces HOT 3
- Bug: /languages redirect improperly matching subpaths
- Add MEV diagrams to the diagrams page HOT 14
- Figment staking as a service HOT 4
- Bug report: Broken link in Design and UX page HOT 1
- A
- Improvements to the code of Merkle Patricia Trie doc HOT 1
- Remove Gitcoin bounties from get involved page HOT 8
- Bug report: Incorrect tooltip on what-is-ethereum page HOT 1
- Link [execution-diversity.info] change to supermajority.info HOT 7
- Delist: Apex wallet HOT 3
- Suggest a wallet - Braavos HOT 7
- nft
- Q2 2024 ethereum.org product roadmap
- Error: Text content does not match server-rendered HTML when developing on Windows HOT 4
- Update content (add year + call-out) on Translatathon page HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ethereum-org-website.