gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.82k stars 7.54k forks source link

Hugo server does not parse config/_default/outputs.toml in First Run #7434

Closed hollowaykeanho closed 4 years ago

hollowaykeanho commented 4 years ago

What version of Hugo are you using (hugo version)?

$ hugo version
Hugo Static Site Generator v0.73.0-428907CC/extended linux/amd64 BuildDate: 2020-06-23T16:40:09Z

Does this issue reproduce with the latest release?

Tested versions:

  1. v0.73
  2. Hugo Static Site Generator v0.74.1-15163266/extended linux/amd64 BuildDate: 2020-07-13T19:02:45Z
  3. Hugo Static Site Generator v0.74.3-DA0437B4/extended linux/amd64 BuildDate: 2020-07-23T16:30:30Z
  4. Hugo Static Site Generator v0.75.0-FEF924BA linux/amd64 BuildDate: 2020-09-14T09:20:23Z

Issue

Hugo server does not parse config/_default/outputs.toml when first run. That outputs.toml contains the multiple outputs definitions (e.g. HTML, AMP, etc.).

Workaround

There are 2 "1" workaround:

  1. Without stopping the server, explicitly save outputs.toml one time to let hugo server picks up the settings upon self-reload.
  2. Migrate the settings back to config/_default/configs.toml. (EDIT: same outcome. Only first workaround works.)

When Does This Issue Found

During theme module AMP integrations. The shortcode with AMP rendering (.amp.html) does not pick up and render <img> tag instead of <amp-img>.

jmsalazar84 commented 4 years ago

Both workaround are not working for me.

This is my config: config/_default/outputs.toml page = ["HTML","AMP"]

This markup is not working in my project: layouts/_default/_markup/render-image.amp.html

New Workaround I have created a new workaround and consist in create an empty shortcode like this: /shortcodes/footer.html /shortcodes/footer.amp.html

finally, put this shortcode at the end of every md file {{<footer>}}

In my project, only pages that don't use any shortcode (with amp version) present this problem (thats was the way I realized the problem)

hollowaykeanho commented 4 years ago

This is my config: config/_default/outputs.toml page = ["HTML","AMP"]

There are lot more configurations based on the specification. Mine is:

home = [ "HTML", "AMP" ]
page = [ "HTML", "AMP" ]
section = [ "HTML", "AMP" ]
taxonomy = [ "HTML", "AMP" ]
term = [ "HTML", "AMP" ]

Filepath: https://gitlab.com/zoralab/bissetii/-/blob/next/.sites/config/_default/outputs.toml

You need be very careful with amp shortcode because it was the shortcode that I picked up this consistent bug (amp.html version did not render until I save the output.toml explicitly).

hollowaykeanho commented 4 years ago

layouts/_default/_markup/render-image.amp.html

Also, I do not recall any seeker with search layouts/_default/_markup inside layout unless you shift it to partial layouts. Is there a supporting documentation for it?

I'm looking at https://gohugo.io/templates/output-formats/.

jmooring commented 4 years ago

Please test again with 0.74. I suspect this was resolved with https://github.com/gohugoio/hugo/pull/7455.

jmsalazar84 commented 4 years ago

Please test again with 0.74. I suspect this was resolved with #7455.

Hello, I have recently tested with version 0.74 and the problem persists. I think markup is not recognized when a different output like AMP is processed. My workaround works because somehow it tells Hugo that the page is an AMP version and as a consequence the markup knows it in a some way

hollowaykeanho commented 4 years ago

@jmooring. same as @jmsalazar84 . Here's my test result:

Test results with Hugo Static Site Generator v0.74.1-15163266/extended linux/amd64 BuildDate: 2020-07-13T19:02:45Z.

Direct run with v0.73 resources

Result: amp-img is rendered without needing workaround.

Purged v0.73 resources and run v0.74 from scratch

Result: Issue persist. Workaround must be applied in order to make shortcode amp.html works.

Direct run with v0.74 resource

Result: Issue persist. Workaround must be applied in order to make shortcode amp.html works.

Can I get the specification for the layouts/_default/_markup so I can build a CI test for this and issue #7160 please? I can contribute testing effort. Dev team can issue test version in .deb packaging to me ya.

hollowaykeanho commented 4 years ago

Updated on latest test with Hugo Static Site Generator v0.74.3-DA0437B4/extended linux/amd64 BuildDate: 2020-07-23T16:30:30Z:

Issue is still persist. I still need to explicitly save config/_default/outputs.toml everytime I want the .amp.html shortcodes to run.

New findings: it is affecting build command. Currently, building with $ hugo --minify randomly process/ignore multiple output shortcodes. Sometimes it builds correctly, sometimes it does not.

hollowaykeanho commented 4 years ago

Updated on latest test with Hugo Static Site Generator v0.75.0-FEF924BA linux/amd64 BuildDate: 2020-09-14T09:20:23Z.

Issue is still persisting.

hollowaykeanho commented 4 years ago

Close this issue as duplicate of https://github.com/gohugoio/hugo/issues/7160. Proceed to track issue over there.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.