mirror of
https://github.com/Threnklyn/reveal-hugo.git
synced 2026-05-18 21:03:29 +02:00
Use CDN for assets instead of local
Much more friendly for merging into an existing Hugo site
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
<!doctype html>
|
||||
{{- $reveal_cdn := "https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0" -}}
|
||||
{{- $highlight_cdn := "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0" -}}
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
@@ -8,21 +10,23 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<link rel="stylesheet" href="{{ "reveal/css/reveal.css" | relURL }}">
|
||||
{{ $theme := or .Page.Params.reveal_hugo.theme .Site.Params.reveal_hugo.theme .Site.Data.reveal_hugo.theme "black" }}
|
||||
<link rel="stylesheet" href="{{ printf "reveal/css/theme/%s.css" $theme | relURL }}" id="theme">
|
||||
<link rel="stylesheet" href="{{ $reveal_cdn }}/css/reveal.min.css">
|
||||
<!-- Theme used for presentation -->
|
||||
{{ $theme := or .Page.Params.reveal_hugo.theme .Site.Params.reveal_hugo.theme .Site.Data.reveal_hugo.defaults.theme "black" }}
|
||||
<link rel="stylesheet" href="{{ $reveal_cdn }}/css/theme/{{ $theme }}.css" id="theme">
|
||||
<!-- Theme used for syntax highlighting of code -->
|
||||
<link rel="stylesheet" href="{{ "reveal/lib/css/zenburn.css" | relURL }}">
|
||||
{{ $highlight_theme := or .Page.Params.reveal_hugo.highlight_theme .Site.Params.reveal_hugo.highlight_theme .Site.Data.reveal_hugo.defaults.highlight_theme "default" }}
|
||||
<link rel="stylesheet" href="{{ $highlight_cdn }}/styles/{{ $highlight_theme }}.min.css">
|
||||
<!-- Printing and PDF exports -->
|
||||
<script>
|
||||
var link = document.createElement( 'link' );
|
||||
link.rel = 'stylesheet';
|
||||
link.type = 'text/css';
|
||||
link.href = window.location.search.match( /print-pdf/gi ) ? '{{ "reveal/css/print/pdf.css" | relURL }}' : '{{ "reveal/css/print/paper.css" | relURL }}';
|
||||
link.href = window.location.search.match( /print-pdf/gi ) ? '{{ $reveal_cdn}}/css/print/pdf.css' : '{{ $reveal_cdn }}/css/print/paper.css';
|
||||
document.getElementsByTagName( 'head' )[0].appendChild( link );
|
||||
</script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="{{ "reveal/lib/js/html5shiv.js" | relURL }}"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script>
|
||||
<![endif]-->
|
||||
{{ partial "reveal-hugo/head" . }}
|
||||
</head>
|
||||
@@ -34,18 +38,26 @@
|
||||
<script type="text/javascript">
|
||||
window.revealHugoDependencies = {
|
||||
dependencies: [
|
||||
{ src: '{{ "reveal/lib/js/classList.js" | relURL }}', condition: function() { return !document.body.classList; } },
|
||||
{ src: '{{ "reveal/plugin/markdown/marked.js" | relURL }}', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
|
||||
{ src: '{{ "reveal/plugin/markdown/markdown.js" | relURL }}', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
|
||||
{ src: '{{ "reveal/plugin/highlight/highlight.js" | relURL }}', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
|
||||
{ src: '{{ "reveal/plugin/search/search.js" | relURL }}', async: true },
|
||||
{ src: '{{ "reveal/plugin/zoom-js/zoom.js" | relURL }}', async: true },
|
||||
{ src: '{{ "reveal/plugin/notes/notes.js" | relURL }}', async: true }
|
||||
{ src: '{{ $reveal_cdn }}/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
|
||||
{ src: '{{ $reveal_cdn }}/plugin/zoom-js/zoom.js', async: true },
|
||||
// the notes plugin can't run off the CDN b/c the HTML file isn't there
|
||||
{ src: '{{ "reveal-hugo/plugin/notes/notes.js" | relURL }}', async: true }
|
||||
]};
|
||||
</script>
|
||||
<script src="{{ "reveal/lib/js/head.min.js" | relURL }}"></script>
|
||||
<script src="{{ "reveal/js/reveal.js" | relURL }}"></script>
|
||||
<script src="{{ "reveal-hugo/index.js" | relURL }}"></script>
|
||||
<script src="{{ $reveal_cdn }}/lib/js/head.min.js"></script>
|
||||
<script src="{{ $reveal_cdn }}/js/reveal.js"></script>
|
||||
<script type="text/javascript">
|
||||
// pattern inspired by https://github.com/RealOrangeOne/hugo-theme-revealjs
|
||||
var revealHugoPageParams = JSON.parse(document.getElementById('reveal-hugo-page-params').innerHTML);
|
||||
var revealHugoSiteParams = JSON.parse(document.getElementById('reveal-hugo-site-params').innerHTML);
|
||||
var revealHugoDefaults = JSON.parse(document.getElementById('reveal-hugo-defaults').innerHTML);
|
||||
// See all options - https://github.com/hakimel/reveal.js#configuration
|
||||
Reveal.initialize(Object.assign(
|
||||
revealHugoDefaults,
|
||||
revealHugoSiteParams,
|
||||
revealHugoPageParams,
|
||||
revealHugoDependencies));
|
||||
</script>
|
||||
{{ partial "reveal-hugo/body" . }}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user