168 lines
6.2 KiB
HTML
168 lines
6.2 KiB
HTML
|
<!doctype html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<title>Logo presentation example</title>
|
||
|
|
||
|
<meta name="author" content="Josh Dzielak">
|
||
|
<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-js/css/reset.css">
|
||
|
<link rel="stylesheet" href="./reveal-js/css/reveal.css"><link rel="stylesheet" href="./reveal-hugo/themes/robot-lung.css" id="theme"><link rel="stylesheet" href="./highlight-js/default.min.css">
|
||
|
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<style>
|
||
|
#logo {
|
||
|
position: absolute;
|
||
|
top: 1%;
|
||
|
left: 1%;
|
||
|
width: 15%;
|
||
|
}
|
||
|
</style>
|
||
|
<img id="logo" src="github-logo.png" alt="">
|
||
|
|
||
|
<div class="reveal">
|
||
|
<div class="slides">
|
||
|
|
||
|
|
||
|
<section><h2 id="logo-example">logo-example</h2>
|
||
|
<p>This presentation shows how to add a logo to each slide, like the GitHub one you see above.</p>
|
||
|
<p>You can generalize the concept to add any additional markup to your presentations.</p>
|
||
|
</section><section>
|
||
|
<p><a href="https://github.com/dzello/reveal-hugo/blob/master/exampleSite/content/logo-example">See the code for this presentation</a></p>
|
||
|
</section><section>
|
||
|
<p>For a basic setup, in the front matter, add an image to the presentation’s directory.</p>
|
||
|
<p>Then, add a logo section in the front matter:</p>
|
||
|
<pre><code class="language-toml">[logo]
|
||
|
src = "github-logo.png"
|
||
|
</code></pre>
|
||
|
<p>The front matter should end up looking like this:</p>
|
||
|
<pre><code class="language-toml">+++
|
||
|
title = "Logo presentation example"
|
||
|
outputs = ["Reveal"]
|
||
|
[logo]
|
||
|
src = "github-logo.png"
|
||
|
+++
|
||
|
</code></pre>
|
||
|
</section><section>
|
||
|
<p>If the logo placement doesn’t quite match your needs, you may customize it with the following paramaters:</p>
|
||
|
<pre><code class="language-toml">[logo]
|
||
|
src = "github-logo.png" # Location of the file displayed.
|
||
|
alt = "" # Alt text.
|
||
|
width = "15%" # Size of the file.
|
||
|
diag = "1%" # How far from the top right should the file be.
|
||
|
top = "1%" # Overrides diag.
|
||
|
right = "1%" # Overrides diag.
|
||
|
</code></pre>
|
||
|
<ul>
|
||
|
<li>
|
||
|
<p>Instead of absolute (<code>250px</code>), relative measurments (<code>12.5%</code>) should be used. They work better with different screen sizes.</p>
|
||
|
</li>
|
||
|
<li>
|
||
|
<p>By default, null (<code>""</code>) is used as alt text for logos, as otherwise the alt text would unneededly get read by screen readers.</p>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</section><section>
|
||
|
<p>💡 Tip: to make the logo settings present on every presentation, add the settings to your site’s configuration file <code>config.toml</code> under <code>[params.logo]</code>:</p>
|
||
|
<pre><code class="language-toml">[params.logo]
|
||
|
src = "/img/logo.png"
|
||
|
</code></pre>
|
||
|
<p>Note that now, the path to the logo file shall be absolute, and should be stored in <code>static/img/logo.png</code> instead.</p>
|
||
|
</section><section>
|
||
|
<p>Depending on the theme you’re using, your styles will be different. <br>You may also prefer to put your CSS in an external file or your Reveal.js theme.</p>
|
||
|
<p>For per-presentation override, you may add custom CSS with the ID <code>#logo</code> to:</p>
|
||
|
<pre><code class="language-text">layouts/partials/{section}/reveal-hugo/body.html
|
||
|
</code></pre>
|
||
|
<p>Substitute <code>{section}</code> for <code>home</code> if you are adding a logo to the presentation at <code>content/_index.md</code>. Otherwise, substitute the name of the Hugo section where your presentation lives.</p>
|
||
|
<p>For a site-wide override, use:</p>
|
||
|
<pre><code class="language-text">layouts/partials/{section}/reveal-hugo/body.html
|
||
|
</code></pre>
|
||
|
</section><section>
|
||
|
<h1 id="heading">🤗</h1>
|
||
|
<p>That’s it.</p>
|
||
|
<p>Happy Hugo-ing!</p>
|
||
|
</section>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
<script type="text/javascript" src=./reveal-hugo/object-assign.js></script>
|
||
|
|
||
|
<a href="./reveal-js/css/print/" id="print-location" style="display: none;"></a>
|
||
|
<script type="text/javascript">
|
||
|
var printLocationElement = document.getElementById('print-location');
|
||
|
var link = document.createElement('link');
|
||
|
link.rel = 'stylesheet';
|
||
|
link.type = 'text/css';
|
||
|
link.href = printLocationElement.href + (window.location.search.match(/print-pdf/gi) ? 'pdf.css' : 'paper.css');
|
||
|
document.getElementsByTagName('head')[0].appendChild(link);
|
||
|
</script>
|
||
|
|
||
|
<script type="application/json" id="reveal-hugo-site-params">{"history":true,"templates":{"grey":{"background":"#424242","transition":"convex"}}}</script>
|
||
|
<script type="application/json" id="reveal-hugo-page-params">{"custom_theme":"reveal-hugo/themes/robot-lung.css","margin":0.2}</script>
|
||
|
|
||
|
<script src="./reveal-js/js/reveal.js"></script>
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
|
||
|
|
||
|
function camelize(map) {
|
||
|
if (map) {
|
||
|
Object.keys(map).forEach(function(k) {
|
||
|
newK = k.replace(/(\_\w)/g, function(m) { return m[1].toUpperCase() });
|
||
|
if (newK != k) {
|
||
|
map[newK] = map[k];
|
||
|
delete map[k];
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
return map;
|
||
|
}
|
||
|
|
||
|
var revealHugoDefaults = { center: true, controls: true, history: true, progress: true, transition: "slide" };
|
||
|
var revealHugoSiteParams = JSON.parse(document.getElementById('reveal-hugo-site-params').innerHTML);
|
||
|
var revealHugoPageParams = JSON.parse(document.getElementById('reveal-hugo-page-params').innerHTML);
|
||
|
|
||
|
var options = Object.assign({},
|
||
|
camelize(revealHugoDefaults),
|
||
|
camelize(revealHugoSiteParams),
|
||
|
camelize(revealHugoPageParams));
|
||
|
Reveal.initialize(options);
|
||
|
</script>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<script type="text/javascript" src="./reveal-js/plugin/markdown/marked.js"></script>
|
||
|
|
||
|
<script type="text/javascript" src="./reveal-js/plugin/markdown/markdown.js"></script>
|
||
|
|
||
|
<script type="text/javascript" src="./reveal-js/plugin/highlight/highlight.js"></script>
|
||
|
|
||
|
<script type="text/javascript" src="./reveal-js/plugin/zoom-js/zoom.js"></script>
|
||
|
|
||
|
|
||
|
<script type="text/javascript" src="./reveal-js/plugin/notes/notes.js"></script>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<style>
|
||
|
#logo {
|
||
|
position: absolute;
|
||
|
top: 20px;
|
||
|
left: 20px;
|
||
|
width: 250px;
|
||
|
}
|
||
|
</style>
|
||
|
<img id="logo" src="github-logo.png" alt="">
|
||
|
</body>
|
||
|
</html>
|