Add an end option for inserting HTML before end of .reveal
This commit is contained in:
parent
4eca16bd42
commit
9b47e50246
4 changed files with 33 additions and 20 deletions
|
@ -82,7 +82,7 @@ Use partials to add HTML to the page for one or all presentations at a time.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Here is where partials go for different presentations and places on the page.
|
Here is where to put partials for different presentations and places in the DOM.
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
| Presentation | Before </head> | Before </body> |
|
| Presentation | Before </head> | Before </body> |
|
||||||
|
@ -91,6 +91,12 @@ Here is where partials go for different presentations and places on the page.
|
||||||
| Root | home/reveal-hugo/head.html | home/reveal-hugo/body.html |
|
| Root | home/reveal-hugo/head.html | home/reveal-hugo/body.html |
|
||||||
| Section | {section}/reveal-hugo/head.html | {section}/reveal-hugo/body.html |
|
| Section | {section}/reveal-hugo/head.html | {section}/reveal-hugo/body.html |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<small>
|
||||||
|
💡 You can also create an `end.html` to put content before the end of the `.reveal` div tag.
|
||||||
|
</small>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Custom CSS Example
|
## Custom CSS Example
|
||||||
|
|
|
@ -39,7 +39,18 @@
|
||||||
{{- if fileExists (printf "layouts/partials/%s.html" $sectionHeadPartial) -}}{{ partial $sectionHeadPartial . }}{{- end }}
|
{{- if fileExists (printf "layouts/partials/%s.html" $sectionHeadPartial) -}}{{ partial $sectionHeadPartial . }}{{- end }}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{- block "main" . -}}{{- end -}}
|
<div class="reveal">
|
||||||
|
<div class="slides">
|
||||||
|
{{- block "main" . -}}{{- end -}}
|
||||||
|
</div>
|
||||||
|
<!-- To insert markup at the end of the .reveal tag for all presentations,
|
||||||
|
create layouts/partials/reveal-hugo/end.html -->
|
||||||
|
{{- partial "reveal-hugo/end" . -}}
|
||||||
|
<!-- To insert markup at the end of the .reveal tag for a specific presentation,
|
||||||
|
create layouts/partials/{section}/reveal-hugo/end.html -->
|
||||||
|
{{- $sectionHeadPartial := printf "%s/reveal-hugo/end" (.Page.Section | default "home") -}}
|
||||||
|
{{- if fileExists (printf "layouts/partials/%s.html" $sectionHeadPartial) -}}{{ partial $sectionHeadPartial . }}{{- end }}
|
||||||
|
</div>
|
||||||
<script type="application/json" id="reveal-hugo-site-params">{{ jsonify .Site.Params.reveal_hugo | safeJS }}</script>
|
<script type="application/json" id="reveal-hugo-site-params">{{ jsonify .Site.Params.reveal_hugo | safeJS }}</script>
|
||||||
<script type="application/json" id="reveal-hugo-page-params">{{ jsonify .Page.Params.reveal_hugo | safeJS }}</script>
|
<script type="application/json" id="reveal-hugo-page-params">{{ jsonify .Page.Params.reveal_hugo | safeJS }}</script>
|
||||||
<script type="text/javascript"> window.revealHugoDependencies = { dependencies: [ { src: '{{ $reveal_cdn }}/lib/js/classList.js', condition: function() { return !document.body.classList; } },
|
<script type="text/javascript"> window.revealHugoDependencies = { dependencies: [ { src: '{{ $reveal_cdn }}/lib/js/classList.js', condition: function() { return !document.body.classList; } },
|
||||||
|
|
1
layouts/partials/reveal-hugo/end.html
Normal file
1
layouts/partials/reveal-hugo/end.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<!-- override this partial to add content before the .reveal tag closes -->
|
|
@ -1,22 +1,17 @@
|
||||||
<div class="reveal">
|
<!-- Use the array of pages passed as a param -->
|
||||||
<!-- Any section element inside of this container is displayed as a slide -->
|
{{ range . -}}
|
||||||
<div class="slides">
|
<!-- Don't process empty content files -->
|
||||||
<!-- Use the array of pages passed as a param -->
|
{{- if ne (len .Content) 0 -}}
|
||||||
{{ range . -}}
|
<!-- Remove the <hr /> tag generated by blackfriday for footnotes -->
|
||||||
<!-- Don't process empty content files -->
|
{{- $content := replace .Content "<div class=\"footnotes\">\n\n<hr />" "<div class=\"footnotes\">" -}}
|
||||||
{{- if ne (len .Content) 0 -}}
|
<!-- Split the processed content by <hr /> tag -->
|
||||||
<!-- Remove the <hr /> tag generated by blackfriday for footnotes -->
|
{{- range (split $content "<hr />") -}}
|
||||||
{{- $content := replace .Content "<div class=\"footnotes\">\n\n<hr />" "<div class=\"footnotes\">" -}}
|
<!-- Only wrap in <section> tag if not already wrapped by shortcode -->
|
||||||
<!-- Split the processed content by <hr /> tag -->
|
{{- if not (in . "data-noprocess") -}}
|
||||||
{{- range (split $content "<hr />") -}}
|
|
||||||
<!-- Only wrap in <section> tag if not already wrapped by shortcode -->
|
|
||||||
{{- if not (in . "data-noprocess") -}}
|
|
||||||
<section>
|
<section>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- . | safeHTML -}}
|
{{- . | safeHTML -}}
|
||||||
</section>
|
</section>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
Loading…
Reference in a new issue