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

✨ feat: allow relative paths for image shortcodes #222

Merged
merged 1 commit into from
Nov 24, 2023

Conversation

welpo
Copy link
Owner

@welpo welpo commented Nov 24, 2023

Summary

This PR updates all image shortcodes to support relative paths.

Changes

All image shortcodes within the theme have been modified to first attempt to locate images using a relative path. If the image is not found, the shortcode then defaults to the specified absolute path.

Before, for co-located assets, this was necessary (e.g. for a post in blog/shortcodes/index.md):

{{ invertible_image(src="blog/shortcodes/img/graph.webp", alt="Invertible graph") }}

Now, it's possible to use the same format of relative path that you'd use for a normal image:

{{ invertible_image(src="img/graph.webp", alt="Invertible graph") }}

Accessibility

No specific accessibility changes were made in this PR, as the updates primarily concern backend image path handling. The front-end display and accessibility of images remain unchanged.

Type of change

  • Bug fix
  • New feature
  • UI/UX improvement
  • Refactor
  • Documentation update
  • Other (please describe below)

Checklist

  • I have tested all possible scenarios for this change
  • I have made corresponding changes to the documentation:
    • Updated "Shortcodes" post in English
    • Updated "Shortcodes" post in Spanish
    • Updated "Shortcodes" post in Catalan

@welpo welpo added the enhancement New feature or request label Nov 24, 2023
@welpo welpo merged commit 7796162 into main Nov 24, 2023
1 check passed
@welpo welpo deleted the feat/img-shortcode-relative-paths branch November 24, 2023 01:10
Smtbook pushed a commit to Smtbook/zola-theme-tabi that referenced this pull request Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant