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

shortcode for images #55

Closed
ghost opened this issue Jul 22, 2020 · 6 comments
Closed

shortcode for images #55

ghost opened this issue Jul 22, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Jul 22, 2020

Hi Rise, is it possible to create a custom hugo shortcode for images so that you can do the following:

  1. resize
  2. align
  3. add caption

Maybe something like https://themes.gohugo.io//theme/cupper-hugo-theme/cupper-shortcodes/#figurecupper

@AmazingRise AmazingRise added the enhancement New feature or request label Jul 22, 2020
@AmazingRise
Copy link
Owner

Good idea, I'll try to implement.
Thanks for your feedback.

@ghost
Copy link
Author

ghost commented Jul 22, 2020

Thank you, let me know if you need any help and I will try my best to help you! :)

@AmazingRise
Copy link
Owner

Hi, STYJ.
I added a insertFigure command, see wiki for details.
And I push the code to master branch.

Please try it.
If no further problems are found, please close this issue.

Thanks for your support.

@ghost
Copy link
Author

ghost commented Jul 29, 2020

Hi Rise, thank you for the quick work! I have tested it and it is really good! Wiki explanation is good too!

However, I had 1 problem - when I tried to use a .gif file for img insertFigure, the gif shows up but it doesn't play. Is it possible to also play gifs?

@AmazingRise
Copy link
Owner

And I have to say, this is only a wrapper of Hugo's image processor.
The reason for that may be Hugo's image processor convert the gif into a static image when cropping it.

If you want to insert gif files, in the way other figures did, you can ditrctly write HTML code,<figure>...</figure> in your content, without using Hugo's cropping command.
(You can refer to /themes/diary/layout/shortcodes/insertFigure.html)

(Don't forget to switch on safe HTML option in config.toml)

@ghost
Copy link
Author

ghost commented Jul 29, 2020

Understood! Thanks for explaining :)

@ghost ghost closed this as completed Jul 29, 2020
This issue was closed.
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

No branches or pull requests

1 participant