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

single.html can not render #23

Open
xwydq opened this issue Feb 7, 2018 · 4 comments
Open

single.html can not render #23

xwydq opened this issue Feb 7, 2018 · 4 comments

Comments

@xwydq
Copy link

xwydq commented Feb 7, 2018

single.html can not render success by

<p class="terms">
  {{ range $i := (slice "categories" "tags") }}
  {{ with ($.Param $i) }}
  {{ $i | title }}: 
  {{ range $k := . }}
  <a href='{{ relURL (print "/" $i "/" $k | urlize) }}'>{{$k}}</a> 
  {{ end }}
  {{ end }}
  {{ end }}
</p>

format

error message:

Building sites … ERROR 2018/02/07 17:03:32 Error while rendering "page" in "note/": template: theme/_default/single.html:10:17: executing "theme/_default/single.html" at <.>: range can't iterate over HTML
@yihui
Copy link
Owner

yihui commented Feb 7, 2018

Your Hugo version? Reproducible example?

@xwydq
Copy link
Author

xwydq commented Feb 8, 2018

$ hugo version
Hugo Static Site Generator v0.35 linux/amd64 BuildDate: 2018-01-31T10:44:43Z

The version can not support this template syntax?

@yihui
Copy link
Owner

yihui commented Feb 8, 2018

I remember I have been testing this theme since Hugo 0.17, and I have never seen this problem.

I asked for a minimal reproducible example, and you didn't provide it.

@casperl
Copy link

casperl commented Apr 8, 2019

For future reference: I had this error and the problem had to do with taxonomies that did not exist which is why the page compiler reports the "range cannot iterate over HTML". I renamed a front matter taxonomy term (as in merke = ["A", "B", "C"]) to a different name and changed the respective pages' front matter. But it left dangling links in the body text to a non-existent taxonomy item [MyLink](/merke/mytag). I then performed a recursive search through everything in /content for all posts containing the incorrect taxonomy term (using the Linux ack command) and corrected this.

When designing a theme or shortcode, care must be taken not to link to taxonomy references that do not exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants