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

Basic CDN shortcode for Images and Downloads #489

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rterakedis
Copy link
Contributor

I no longer wanted to host images and downloadable files in the Github repo backing my Hugo site. Instead, I'm hosting these images in a cloud bucket and wanted to make a shortcode to simplify creating the links. This specific PR aims to share what I've created in the hopes that the community can iterated on the code and improve.

Pull Request type

Please check the type of change your PR introduces:

  • Bug-fix
  • Feature (functionality, design, translations, etc.)
  • Documentation change
  • Project management (tests, CI, GitHub configuration, etc.)
  • Other (please describe):

Current state

Most shortcodes in Hugo assume files and images are stored as assets or as part of page bundles.

Proposed changes

This PR creates a cdn shortcode that allows you to quickly add files from your "CDN" (such as S3, B2, etc) into the markdown: {{< cdn [img|file|hlimg] [filename.extension] [alt name or link name] >}}

Screenshots, if applicable

N/A -- the change is not visual per see, but rather modifies how Hugo generates the image/file source.

Checklist

  • Bug-fixes and new features: I have tested locally with the latest release of Hugo extended. This requirement is a standard.
  • Bug-fixes, new features, and doc changes: I have updated the relevant documentation as part of this PR.
  • All PRs: I have signed off (using git commit -s ...), or if not possible due to developer environment constraints, will comment below confirming that I am adhering to the Developer Certificate of Origin.

Signed-off-by: Robert Terakedis <[email protected]>
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.

2 participants