We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When using a yaml front matter with a multiline description that uses a Block Style Indicator (> or |)
--- title: Simple title chapter: false weight: 40 description: | This is the beginning of a multiline description... ---
The JSON file generated by the index.json template is invalid: The description contains a \n at the end:
\n
[ { "uri": "/example.html", "title": "Simple title", "tags": [], "description": "This is the beginning of a multiline description... ", "content": "blah" } ]
My attempt at fixing this issue is to trim the extra\n in the template:
diff --git a/layouts/index.json b/layouts/index.json index 367f3b3..011b7c8 100644 --- a/layouts/index.json +++ b/layouts/index.json @@ -5,7 +5,7 @@ "uri": "{{ $page.Permalink }}", "title": "{{ htmlEscape $page.Title}}", "tags": [{{ range $tindex, $tag := $page.Params.tags }}{{ if $tindex }}, {{ end }}"{{ $tag| htmlEscape }}"{{ end }}], - "description": "{{ htmlEscape .Description}}", + "description": "{{ trim .Description "\n" | htmlEscape }}", "content": {{$page.Plain | jsonify}} } {{- end -}}
This seems to work for me but I am very new at Hugo templating... Am I on the right track ? Is there a way to fix this in a better way ?
Thank you in Advance.
The text was updated successfully, but these errors were encountered:
Seems to work in the Relearn fork.
Sorry, something went wrong.
Test for matcornic/hugo-theme-learn#517
a2fa096
No branches or pull requests
When using a yaml front matter with a multiline description that uses a Block Style Indicator (> or |)
The JSON file generated by the index.json template is invalid: The description contains a
\n
at the end:My attempt at fixing this issue is to trim the extra
\n
in the template:This seems to work for me but I am very new at Hugo templating... Am I on the right track ? Is there a way to fix this in a better way ?
Thank you in Advance.
The text was updated successfully, but these errors were encountered: