Hi all.
I have a small project like this:
.
├── asset
│ ├── images
│ │ ├── image1.jpg
│ │ ├── image2.jpg
│ │ └── ...
│ ├── js
│ │ └── ...
│ └── scss
│ └── ...
├── content
│ ├── doc
│ │ ├── page1.md
│ │ └── page2.md
│ └── ...
└── layout
└── doc
├── list.html
└── single.html
I want to include the related image for each document in the document itself using plain markdown code (I know this wouldn’t work as explained in the documentation: https://gohugo.io/hugo-pipes/introduction/#asset-publishing).
# content/doc/pageX.md
---
title: Page number X
---
[!image X](/images/imageX.jpg)
and in the list page for all the docs use a thumbnail:
# layouts/doc/list.html
{{ $range .Pages }}
{{ $basename := .File.Basename }}
{{ $asset := printf "%s.jpg" $basename }}
{{ $thumbnail := $asset.Resize "250x" }}
<img src="{{ $thumbnail.Permalink }}">
{{ end }}
The thumbnails are shown in the listing but the images aren’t shown in the pages, as expected
I’d like to know what are the best practices to deal with problems like these:
- Duplicate images in
assets/imagesandstatic/images. - Create symbolic links between
static/imagesandassets/images? - Use shortcodes in .md files to force the
{{ .Permalink }}rule (it would prevent from use plain markdown) - Add
assetsto the static directory list lookup withstaticDir(it would copy a lot of non-processed files as well)
Do I miss a better approach?
Thanks.