Skip to main content
  1. Extra/

Hugo Docsy Revealjs Boilerplate Code

·363 words·2 mins· loading · ·

On This Page

Table of Contents
Share with :

You can use reveal.js presentations alongside your Hugo site using the Docsy theme. They serve different purposes and can coexist smoothly with a bit of setup:


✅ What is reveal.js?
#

reveal.js is a JavaScript framework for building slide decks (HTML-based presentations). It’s independent of Hugo or Docsy but can be integrated as a standalone layout or content type within your Hugo site.


✅ Integration Approaches
#

🔹 Option 1: Static Integration (Recommended)#

Use reveal.js by directly including its assets and creating a custom Hugo layout for presentations.

📁 1. Add reveal.js assets
#

Download or npm-install reveal.js, and copy its dist folder to your Hugo project:

your-hugo-site/
└── static/
    └── revealjs/
        ├── reveal.js
        ├── css/
        ├── js/
        └── plugin/

Or link to CDN versions (e.g. via unpkg) to save size.

📄 2. Create a presentation page
#

In content/presentations/my-talk.md:

---
title: "My Reveal.js Talk"
layout: "reveal"
---

<section>
  <h2>Welcome</h2>
  <p>This is a slide</p>
</section>

<section>
  <h2>Another Slide</h2>
</section>

🧱 3. Create a custom layout
#

In layouts/_default/reveal.html:

<!DOCTYPE html>
<html>
<head>
  <title>{\{ .Title }\}</title>
  <link rel="stylesheet" href="/revealjs/dist/reveal.css">
  <link rel="stylesheet" href="/revealjs/dist/theme/black.css">
</head>
<body>
  <div class="reveal">
    <div class="slides">
      {\{ .Content | safeHTML }\}
    </div>
  </div>
  <script src="/revealjs/dist/reveal.js"></script>
  <script>
    Reveal.initialize();
  </script>
</body>
</html>

Then navigate to /presentations/my-talk/ to view it!


🔹 Option 2: Use a Hugo Module for Reveal.js
#

Some Hugo themes/modules offer reveal.js support. You could import such a module alongside Docsy via config/_default/module.toml, but it’s usually overkill unless you’re doing lots of slides.


🔹 Option 3: Use shortcodes to embed Reveal sections
#

You could create shortcodes for slides and use them inside normal Docsy pages — helpful for interactive guides or embedded decks.


🧠 Can You Mix Docsy and Reveal.js?
#

Yes — Docsy handles your main site layout, navigation, etc. You:

  • Use reveal.js in a dedicated section/layout
  • Avoid letting Docsy style or interfere with presentation pages
  • Add navigation back to your Docsy site in the presentation if needed

✅ Summary
#

TaskTool
Site structure, docs, layoutDocsy (Hugo theme)
Presentation slidesreveal.js (JS presentation framework)
Integration methodCustom layout or CDN assets

Would you like a working example with both Docsy and Reveal.js in a sample Hugo project?

Dr. Hari Thapliyaal's avatar

Dr. Hari Thapliyaal

Dr. Hari Thapliyal is a seasoned professional and prolific blogger with a multifaceted background that spans the realms of Data Science, Project Management, and Advait-Vedanta Philosophy. Holding a Doctorate in AI/NLP from SSBM (Geneva, Switzerland), Hari has earned Master's degrees in Computers, Business Management, Data Science, and Economics, reflecting his dedication to continuous learning and a diverse skill set. With over three decades of experience in management and leadership, Hari has proven expertise in training, consulting, and coaching within the technology sector. His extensive 16+ years in all phases of software product development are complemented by a decade-long focus on course design, training, coaching, and consulting in Project Management. In the dynamic field of Data Science, Hari stands out with more than three years of hands-on experience in software development, training course development, training, and mentoring professionals. His areas of specialization include Data Science, AI, Computer Vision, NLP, complex machine learning algorithms, statistical modeling, pattern identification, and extraction of valuable insights. Hari's professional journey showcases his diverse experience in planning and executing multiple types of projects. He excels in driving stakeholders to identify and resolve business problems, consistently delivering excellent results. Beyond the professional sphere, Hari finds solace in long meditation, often seeking secluded places or immersing himself in the embrace of nature.

Comments:

Share with :