gokarna-theme / gokarna-hugo

A minimal opinionated theme for Hugo
https://gokarna-hugo.netlify.app
GNU General Public License v3.0
357 stars 139 forks source link

Adding caption to images in Markdown #158

Closed fabrizio-ottati closed 1 year ago

fabrizio-ottati commented 1 year ago

Is there a way to add a caption to the images in the blog posts?

jamesericdavidson commented 1 year ago

Not in Markdown, but you can use the Hugo shortcode:

https://gohugo.io/content-management/shortcodes/#figure

Regards, Jimmy

-------- Original Message -------- On Mar 13, 2023, 6:21 AM, Fabrizio Ottati wrote:

Is there a way to add a caption to the images in the blog posts?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

fabrizio-ottati commented 1 year ago

Thanks! Is there any way to center the caption?

jamesericdavidson commented 1 year ago

You can add this to main.css:

figcaption {
text-align: center;
}

Or you can make your own shortcode:

https://gohugo.io/templates/shortcode-templates/#single-named-example-image

Regards, Jimmy

-------- Original Message -------- On Mar 13, 2023, 8:06 AM, Fabrizio Ottati wrote:

Thanks! Is there any way to center the caption?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

jamesericdavidson commented 1 year ago

Emails don't support Markdown, so in this file:

static/css/main.css

Add this:

figcaption {
    text-align: center;
}

You can accomplish this by creating a fork of the theme, or with overrides: https://gohugobrasil.netlify.app/themes/customizing/

fabrizio-ottati commented 1 year ago

fantastic! Thank you very much :)

jamesericdavidson commented 1 year ago

Happy to help