PeterSmith.Org

Images and page bundles


I use a feature of Hugo called page bundles.

With pages bundles, resources such as images are kept in the same directory as the content of a post. This keeps things a little more simple, but it does mean that OrgMode's linking system is broken.

Until now, to include an image I've been using a shortcode such as this:

{ {< img src="AaronParecki-Sparklines.png"
   title="Screenshot of sparklines from Aaron Parecki"
   width="50%" >}}

Which calls themes/NewPapyrus/layouts/shortcodes/img.html

{{ $image := .Page.Resources.GetMatch (.Get "src" )}}
{{ $title := .Get "title" }}
{{ $class := .Get "class" }}
{{ $alt   := .Get "alt" }}
{{ $width := .Get "width" }}
<figure>
  <img src="{{ $image.RelPermalink }}" alt="{{ $alt }}" class="{{ $class }}" width="{{ $width }}" />
  <figcaption><h4>{{ $title }}</h4></figcaption>
</figure>

That does the job.

If you webmention this page, please let me know the URL of your page.

BTW: Your webmention won't show up until I next "build" my site.

Show all the shares aka https://keithjgrant.com/posts/2019/01/low-friction-workflow-for-notes/