Following the discussion at #2
Don't know if this is possible, but it would be great to provide Hugo shortcode support alongside the existing Hexo support.
The Pendulum shortcode for Hexo is {% asset_img url "caption" %}.
To make this work with Hugo the shortcode needs to be like so {{% asset_img "url" "caption" %}}.
Adding the double quotes to the shortcode URL is essential to make Pendulum an out-of-the-box editor for Hugo. The double curly brackets are not that essential.
Also here is the actual Hugo shortcode that I authored for use in tandem with Pendulum.
This shortcode will render an img that is in the same directory as the respective content file of a Hugo project. I am getting the content directory path with a bit of RegEx and as a bonus I have included the imageConfig function to get the dimensions of the image.
Contents of asset_img.html
<!-- image -->
<figure>
{{ $base := $.Page.Permalink | replaceRE "([^/]*)/$" "" }}
{{ $link := $.Page.RelPermalink | replaceRE "([^/]*)/$" "" }}
{{ $file := .Get 0 }}
{{ $.Scratch.Add "src" $link }}
{{ $.Scratch.Add "src" $file }}
{{ $src:= $.Scratch.Get "src"}}
{{ $config := imageConfig (printf "/content/%s" $src) }}
<img src="{{ $base }}{{ .Get 0 }}" alt="{{ with $.Page.Params.title}}{{.}}{{end}}" height="{{$config.Height}}" width="{{$config.Width}}" />
<noscript>
<img src="{{ $base }}{{ .Get 0 }}" alt="{{ with $.Page.Params.title}}{{.}}{{end}}"/>
</noscript>
</figure>
<!-- image -->
If you choose to support the Hugo shortcode, feel free to include the above to the Release Notes to help other users.
Again thank you very much for Pendulum.
Following the discussion at #2
Don't know if this is possible, but it would be great to provide Hugo shortcode support alongside the existing Hexo support.
The Pendulum shortcode for Hexo is
{% asset_img url "caption" %}.To make this work with Hugo the shortcode needs to be like so
{{% asset_img "url" "caption" %}}.Adding the double quotes to the shortcode URL is essential to make Pendulum an out-of-the-box editor for Hugo. The double curly brackets are not that essential.
Also here is the actual Hugo shortcode that I authored for use in tandem with Pendulum.
This shortcode will render an img that is in the same directory as the respective content file of a Hugo project. I am getting the content directory path with a bit of RegEx and as a bonus I have included the
imageConfigfunction to get the dimensions of the image.Contents of
asset_img.htmlIf you choose to support the Hugo shortcode, feel free to include the above to the Release Notes to help other users.
Again thank you very much for Pendulum.