Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
hollowaykeanho opened this issue Jun 27, 2020 · 10 comments
Closed
Labels

Comments

@hollowaykeanho
Copy link

hollowaykeanho commented Jun 27, 2020

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>.

@hollowaykeanho hollowaykeanho changed the title Hugo server does not parse config/_default/outputs.toml at Start Hugo server does not parse config/_default/outputs.toml at First Run Jun 27, 2020
@hollowaykeanho hollowaykeanho changed the title Hugo server does not parse config/_default/outputs.toml at First Run Hugo server does not parse config/_default/outputs.toml in First Run Jun 27, 2020
@jmsalazar84
Copy link

jmsalazar84 commented Jul 8, 2020

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
Copy link
Author

hollowaykeanho commented Jul 9, 2020

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
Copy link
Author

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
Copy link
Member

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

@jmsalazar84
Copy link

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
Copy link
Author

hollowaykeanho commented Jul 15, 2020

@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
Copy link
Author

hollowaykeanho commented Aug 10, 2020

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
Copy link
Author

hollowaykeanho commented Sep 14, 2020

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
Copy link
Author

Close this issue as duplicate of #7160. Proceed to track issue over there.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants