I am trying to experiment with Hugo Outputs now to get AMP natively along with my standard theme.
page = [ "HTML", "AMP"]
home = [ "HTML", "RSS", "AMP"]
Then I go into modifying my theme.
I am using heavily modified to my need Minos theme that is starting it build with
So, reading how things working with hugo I will need to make two files, which one
list.html will build standard pages and
list.amp.html will go for AMP pages.
But it doesn’t look like hugo is using
list.amp.html file, only
list.html even for AMP output.
ps. how I know that is not using
Apart from the obvious source page analysis I made (on purpose) a mess in
list.amp.html file that shall result in error during build but it doesn’t.
Or is it simply not working with
list.html and shall concentrate my efforts on
single.amp.html and in config apply AMP only for posts and ignore home?
If yes, is that a bug that on HOME not working
list.amp.html as its clearely listed that is shall here.
It would be easier to help you if you had your site code in a repo somewhere we can have a look at.
I can’t replicate what issue you are having without knowing what changes you have made to the theme and what your config / content look like.
It doesn’t matter about the changes that I made. I used this theme for testing purposes and cannot see the ability to use
list.amp.html for AMP output, hence my modified code, that doesn’t modify basic functionality, is irrelevant.
Looking at this I see that somebody go a similar issue which was left without an answer, is that not working by Hugo design or is not working because of the bug.
Have a look at the layout lookup rules here: https://gohugo.io/templates/lookup-order/#examples-layout-lookup-for-home-page
I’ve removed the non-relevant lines for clarity:
layouts/list.amp.html ### 1
layouts/index.html ### 2
layouts/_default/list.amp.html ### 3
layouts/_default/index.html ### 4
As you can see, it will prefer to use 2 over 3.
list.amp.html placed in
layouts/ than is working
Logically thinking that doesn’t make sense, as when
list.html is in
/layouts/_default than adding different output i.e. AMP, you will think that you need to put this in same place i.e.
/layouts/_default but not, it need to be:
Wonder if that intentional @bep ?
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.