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 path in image.html #101

Merged
merged 2 commits into from
Aug 20, 2024
Merged

Fix path in image.html #101

merged 2 commits into from
Aug 20, 2024

Conversation

remibetin
Copy link
Member

@remibetin remibetin commented Aug 20, 2024

Resolves w3c/wai-website#829

Expected behaviour

  • When the resource is not developed in the main wai-website repo, the image src should be prepended with /content-images/{name of the repo}/
  • Else, the image src should be prepended with /content-images/

Current behaviour

  • When the resource is not developed in the main wai-website repo, the image src is prepended with /content-images/{name of the repo}/: OK ✅
  • When the resource is developed in the main wai-website repo, the image src is prepended with /content-images//: Not OK ❌

Source of the problem

{%- assign repo = page.github.repository | replace: "w3c/", "" -%}
{%- if repo != "wai-website" -%}
{%- assign path = "/" | prepend: repo | prepend: "/content-images/" | relative_url -%}
{%- else -%}
{%- assign path = "/content-images/" | relative_url -%}
{%- endif -%}

Solution

{%- if page.github.repository -%}
{%- assign repo = page.github.repository | replace: "w3c/", "" -%}
{%- assign path = "/" | prepend: repo | prepend: "/content-images/" | relative_url -%}
{%- else -%}
{%- assign path = "/content-images/" | relative_url -%}
{%- endif -%}

Copy link

netlify bot commented Aug 20, 2024

Deploy Preview for wai-website-theme ready!

Name Link
🔨 Latest commit 7da7cba
🔍 Latest deploy log https://app.netlify.com/sites/wai-website-theme/deploys/66c46ce5f6a7490008fc99a1
😎 Deploy Preview https://deploy-preview-101--wai-website-theme.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.

@remibetin remibetin merged commit 2515503 into master Aug 20, 2024
5 checks passed
@remibetin remibetin deleted the fix-image-path branch August 20, 2024 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User stories have missing images
1 participant