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

Regression in 0.60.0 for $headless ? #6552

Closed
jensamunch opened this issue Nov 28, 2019 · 13 comments · Fixed by #6558
Closed

Regression in 0.60.0 for $headless ? #6552

jensamunch opened this issue Nov 28, 2019 · 13 comments · Fixed by #6558

Comments

@jensamunch
Copy link

jensamunch commented Nov 28, 2019

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

Moving from 0.59.1 to 0.60.1 quietely (no warnings) stopped showing our headless content.

Here's an example of the code that outputs nothing with 0.60.0

<section class="customer-logos section">
	<div class="container">
		<div class="customer-logos-inner section-inner has-top-divider">
			<h2 class="section-title text-center mt-0">{{ .Site.Params.logos }}</h2>
			<div class="customer-logos-wrap is-revealing">
				{{ $headless := .Site.GetPage "page" "headless/customer-logos" }}
				{{ $reusablePages := $headless.Resources.Match "*" }}
				{{ range $reusablePages }}
				<div class="customer-logo">
					<a href="{{ .Params.link }}" target="_blank">
						{{ with .Params.image }}
						{{ $original := resources.Get .  }}
						{{ $coverScaled2x := $original.Resize "x160 center" }}
						{{ $coverScaled1x := ($coverScaled2x.Resize "x80") }}
						<img srcset="{{ $coverScaled1x.RelPermalink }} 1x, {{ $coverScaled2x.RelPermalink }} 2x" src="{{ $coverScaled1x.RelPermalink }}" width="{{ $coverScaled1x.Width }}" height="{{ $coverScaled1x.Height }}">
						{{ end }}
					</a>
				</div>
				{{ end }}
			</div>
		</div>
	</div>
</section>
@jensamunch
Copy link
Author

image

@jensamunch
Copy link
Author

image

@jensamunch
Copy link
Author

image

@bep bep added this to the v0.60.1 milestone Nov 28, 2019
@onedrawingperday
Copy link
Contributor

onedrawingperday commented Nov 28, 2019

This seems related to what has already been reported in the forum about HTML with indentation contained in shortcodes and partials being wrapped in pre and code elements.

https://discourse.gohugo.io/t/0-60-0-goldmark-html-indentation-in-partial-shortcode-wrapped-in-pre-code/22019/

I have already advised @divinerites to report this bug in the Hugo issue tracker.

@jensamunch as a workaround please remove the indentation from the HTML and let us know..

@jensamunch
Copy link
Author

Ok will try. Super confusing to me since this is a partial template. I wouldn’t expect Hugo to be opinionated about my formatting there. Only in markup.

Isn’t it normal to beautify HTML code for readability?

@divinerites
Copy link

Yep @jensamunch it is exactly my thought (written in the #6553).

A Workaround is flatting all HTML in partials called by shortcode.

@jensamunch
Copy link
Author

Does atom have a plugin that allows me to flatten all files? Seems like a lot of manual work. Hmm I think I’ll Stay on Black Friday

@jensamunch
Copy link
Author

Hmmm. This doesn't seem to be the same issue. Now back at laptop and there is still no HTML output from flat partial:

<section class="customer-logos section">
<div class="container">
<div class="customer-logos-inner section-inner has-top-divider">
<h2 class="section-title text-center mt-0">{{ .Site.Params.logos }}</h2>
<div class="customer-logos-wrap">
{{ $headless := .Site.GetPage "page" "headless/customer-logos" }}
{{ $reusablePages := $headless.Resources.Match "*" }}
{{ range $reusablePages }}
<div class="customer-logo">
<a href="{{ .Params.link }}" target="_blank">
{{ with .Params.image }}
{{ $original := resources.Get .  }}
{{ $coverScaled2x := $original.Resize "x160 center" }}
{{ $coverScaled1x := ($coverScaled2x.Resize "x80") }}
<img srcset="{{ $coverScaled1x.RelPermalink }} 1x, {{ $coverScaled2x.RelPermalink }} 2x" src="{{ $coverScaled1x.RelPermalink }}" width="{{ $coverScaled1x.Width }}" height="{{ $coverScaled1x.Height }}">
{{ end }}
</a>
</div>
{{ end }}
</div>
</div>
</div>
</section>

@bep
Copy link
Member

bep commented Nov 28, 2019

Stay on Black Friday

That's tomorrow :-)

This seems to be a bug in Goldmark -- I will take that with him. He is very quick in fixing stuff...

I'm closing this in favour of #6553 .

A general tip about shortcodes and HTML is that in some cases it can make sense to use the {{< separator, which makes sure that the Markdown engine does not mess with it.

@bep bep closed this as completed Nov 28, 2019
@jensamunch
Copy link
Author

Actually wait @bep - this is not the same issue.

My headless folder was called "customer-logos". When I changed it to "customerlogos" everything worked again.

No need to flatten the HTML. So unrelated.

@jensamunch
Copy link
Author

I'm super confused. It's randomly working and not working...I'm just changing file names and formatting..I can't make any sense of a pattern.

@bep
Copy link
Member

bep commented Nov 29, 2019

I'm super confused. It's randomly working and not working...

It's called parallelism ... I found the bug and will fix it soon.

bep added a commit to bep/hugo that referenced this issue Nov 29, 2019
@bep bep closed this as completed in bb80fff Nov 29, 2019
@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 Feb 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants