hugo version)?$ hugo version Hugo Static Site Generator v0.68.3/extended linux/amd64 BuildDate: unknown
Yes, CI pipeline is running
$ hugo version Hugo Static Site Generator v0.69.0-4205844B/extended linux/amd64 BuildDate: 2020-04-10T09:16:58Z
An <amp-img> would appear on the page as given in render-image.amp.html
An <img> appears on the page using the template in render-image.html
Code: https://github.com/ct-martin/food/ (note that theme is a git submodule)
Forum thread: https://discourse.gohugo.io/t/markdown-render-hook-image-for-amp-template-not-working/23525/
I am also running into this issue
$ hugo version
Hugo Static Site Generator v0.73.0-428907CC linux/amd64 BuildDate: 2020-06-23T16:30:43Z
Hmm...
Bumped into this issue while enabling AMP alternative output for my theme.
I discovered that this issue https://github.com/gohugoio/hugo/issues/7434 is related. When I explicitly saved my outputs.toml every time, the amp-img works auto-magically.
Please let me know how to further investigate (or close the other ticket if it is considered duplicated).
Please test again with 0.74. I suspect this was resolved with https://github.com/gohugoio/hugo/pull/7455.
Test results with Hugo Static Site Generator v0.74.1-15163266/extended linux/amd64 BuildDate: 2020-07-13T19:02:45Z.
v0.73 resourcesResult: amp-img is rendered without needing workaround.
v0.73 resources and run v0.74 from scratchResult: Issue persist. Workaround from #7434 must be applied in order to make shortcode amp.html works.
v0.74 resourceResult: Issue persist. Workaround from #7434 must be applied in order to make shortcode amp.html works.
EDIT: updated the wrong issue number.
Just for information in the case this issue is fixed and may need for specific test.
When the page with output format AMP using shortcodes "youtube.amp.html" and "render-image.amp.html" together
Example content:

{{< youtube w7Ft2ymGmfc >}}
The output format AMP will get the result correctly and issue https://github.com/gohugoio/hugo/issues/7160 is gone.
but if there is a image without shortcodes,
Example content:

it will hit the issue https://github.com/gohugoio/hugo/issues/7160 .
@bep , double confirmation:
v.0.75.0 right?If item 2 is not clear, I may drop the AMP implementations entirely from the theme module since the multiple output is not functioning properly at build level. =(
This issue is not specific as AMP format, But it affect all format related with Custom Output Formats Feature.
Example config for Custom Output Formats:
[outputFormats]
[outputFormats.AppFormat]
baseName = "index"
name = "app"
isPlainText = false
mediaType = "text/html"
isHTML = true
permalinkable = true
noUgly = false
path = "app"
[outputs]
section = ["HTML", "APP"]
page = ["HTML", "APP"]
Creating render hooks at layouts/_default/_markup/render-image.app.html and this template file is not map too.
I tried to look at AMP output as well and can confirm that when page got YouTube iframe and youtube.amp.html than render-image.amp.html is used as well.
However its not fully up to that. Without render-image... file and set AMP output, does img shall still be converted to amp-img I think, and is not.
Some investigation update hopefully can help:
When I use .Page.AlternativeOutputFormats to investigate an AMP page, it dumps the following output:
map[AMP:{amphtml {AMP text/amphtml index amphtml false true false false true 0} /en-us/components/note/index.amp.html //localhost:8080/en-us/components/note/index.amp.html}]
This indicates that Hugo fails to identify its multiple outputs format where it is supposed to list all other formats except AMP itself.
While the .Page.Permalink behaves weirdly such that it automatically trimmed the output format filename (using suffix mode):
File structure: content/en-us/components/note.md
Request: http://holloway-seraphim:8080/en-us/components/note/index.amp.html
Got: http://holloway-seraphim:8080/en-us/components/note/
Still no chance to find a working workaround since Hugo does not dump any additional user-level information like full request URL (forum URL: https://discourse.gohugo.io/t/how-to-get-requests-url-as-it-is/29392).
EDIT:
layouts/_default/single.*.html), the above works properly.I did not see maintainer activity on this issue, so I belive this issue will not be fixed soon(or never be fixed).
Then I created a new fork https://github.com/neohugo/neohugo, may be you could try. but it migth break the compatible with the hugo too.
it contains fixes related AMP and also optimize memory and maybe faster for large website building.
I thought of forking out the source code but it can be burdening for the long run. At the moment, @bep and his team is working on debugging the recently added npm packages feature. I do not mind the wait.
I do hope maintainers can provide some attention to this issue as multiple outputs feature is completely blocked without workaround from theme developer POV. There is no way to go around permalink or getting a pure request URL for shortcode.
Prehaps can you upstream you workaround fixes for him to review?
I did not see maintainer activity on this issue, so I belive this issue will not be fixed soon(or never be fixed).
Then I created a new fork https://github.com/neohugo/neohugo, may be you could try. but it migth break the compatible with the hugo too.
it contains fixes related AMP and also optimize memory and maybe faster for large website building.
It is probably somehow appreciated that you spend some time and implement changes in relation to this issue. I think, instead of forking Hugo is not a great idea for day-to-day use. For testing in finding a solution, yes. I think @bep and his team would be appreciated if you will rather share your finding and solution to this issue so they can implement this to the main batch.
This issue is not on somehow high priority, but every help counts.
@idarek, are you familiar with the source code specifically at process mapping for shortcode? I do have strong Go background but I need a code navigator as a lighthouse.
The repository is large and it will take some times for me just to understand how things work before fixing any bugs.
@idarek, are you familiar with the source code specifically at process mapping for shortcode? I do have a strong Go background but I need a code navigator as a lighthouse.
The repository is large and it will take some times for me just to understand how things work before fixing any bugs.
Sorry but no. Not a developer but a more rather self-taught person. Can support in testing etc.
Learning Hugo and usage of Go only for couple months soo far, and only in a matter of creating websites (experimenting with mine, to be able to use on other projects).
I thought of forking out the source code but it can be burdening for the long run. At the moment, @bep and his team is working on debugging the recently added npm packages feature. I do not mind the wait.
I do hope maintainers can provide some attention to this issue as multiple outputs feature is completely blocked without workaround from theme developer POV. There is no way to go around permalink or getting a pure request URL for shortcode.
Prehaps can you upstream you workaround fixes for him to review?
You may take a look at PRs that I have been submit or other PR #3934 which is important feature first.
Most helpful comment
This issue is not specific as AMP format, But it affect all format related with Custom Output Formats Feature.
Example config for Custom Output Formats:
Creating render hooks at
layouts/_default/_markup/render-image.app.htmland this template file is not map too.