Closed kortschak closed 4 years ago
Any ideas for a generalised shortcode name?
Ideas include:
I'd suggest "spoiler" as the most commonly used names. This would make it the most discoverable.
To use:
{{< spoiler text="Click to view the spoiler" >}} You found me! {{< /spoiler >}}
Demo:
https://academic-demo.netlify.app/post/writing-technical-content/
When I run ./update_academic.sh
after this, hugo fails. I was previously using a fork from sourcethemes/academic-kickstart@018be3bb4030ac9262521398714c379476007f75 (so 4.9, same minor version) and I don't see any notes in the update pages. Can you point me to why this has broken?
$ hugo server -w
Building sites … ERROR 2020/05/29 07:27:51 render of "page" failed: execute of template failed: template: docs/single.html:2:3: executing "main" at <partial "docs_layout.html" .>: error calling partial: execute of template failed: template: partials/docs_layout.html:48:13: executing "partials/docs_layout.html" at <partial "page_related" .>: error calling partial: "/home/user/Development/kortschak.io/themes/academic/layouts/partials/page_related.html:1:7": execute of template failed: template: partials/page_related.html:1:7: executing "partials/page_related.html" at <index site.Params.show_related .Type>: error calling index: index of untyped nil
ERROR 2020/05/29 07:27:51 render of "page" failed: execute of template failed: template: docs/single.html:2:3: executing "main" at <partial "docs_layout.html" .>: error calling partial: execute of template failed: template: partials/docs_layout.html:48:13: executing "partials/docs_layout.html" at <partial "page_related" .>: error calling partial: "/home/user/Development/kortschak.io/themes/academic/layouts/partials/page_related.html:1:7": execute of template failed: template: partials/page_related.html:1:7: executing "partials/page_related.html" at <index site.Params.show_related .Type>: error calling index: index of untyped nil
ERROR 2020/05/29 07:27:51 render of "page" failed: execute of template failed: template: docs/single.html:2:3: executing "main" at <partial "docs_layout.html" .>: error calling partial: execute of template failed: template: partials/docs_layout.html:48:13: executing "partials/docs_layout.html" at <partial "page_related" .>: error calling partial: "/home/user/Development/kortschak.io/themes/academic/layouts/partials/page_related.html:1:7": execute of template failed: template: partials/page_related.html:1:7: executing "partials/page_related.html" at <index site.Params.show_related .Type>: error calling index: index of untyped nil
ERROR 2020/05/29 07:27:51 render of "page" failed: execute of template failed: template: docs/single.html:2:3: executing "main" at <partial "docs_layout.html" .>: error calling partial: execute of template failed: template: partials/docs_layout.html:48:13: executing "partials/docs_layout.html" at <partial "page_related" .>: error calling partial: "/home/user/Development/kortschak.io/themes/academic/layouts/partials/page_related.html:1:7": execute of template failed: template: partials/page_related.html:1:7: executing "partials/page_related.html" at <index site.Params.show_related .Type>: error calling index: index of untyped nil
Built in 458 ms
Error: Error building site: failed to render pages: render of "page" failed: execute of template failed: template: docs/single.html:2:3: executing "main" at <partial "docs_layout.html" .>: error calling partial: execute of template failed: template: partials/docs_layout.html:48:13: executing "partials/docs_layout.html" at <partial "page_related" .>: error calling partial: "/home/user/Development/kortschak.io/themes/academic/layouts/partials/page_related.html:1:7": execute of template failed: template: partials/page_related.html:1:7: executing "partials/page_related.html" at <index site.Params.show_related .Type>: error calling index: index of untyped nil
Breakage cause by gcushen/hugo-academic@9e562fc076bf8869d6c513d34f7e120dedb63193.
Fix is to add the show_related
attribute to params.toml. Perhaps this value could be nil-guarded in the template to avoid this.
Feature Request
Is your feature request related to a problem? Please describe. In course material it can be helpful to have hidden answers (not to prevent students from getting them, but to prevent them seeing them without even trying).
Describe the solution you'd like Add a way to have mouse-over or click to see spoiler text.
Describe alternatives you've considered There is no reasonable alternative to this that does not cause students to navigate away to another page, losing flow.