mirror of https://github.com/escalate/hugo-split-theme.git

Adrian Föder
06.17.2024 c7b295c65af032e17de9a4386e00f5997940ef03
feat: allow hiding of images and videos

This introduces the option to hide
videos or images on a per-page basis
by configuring the behavior in the
FrontMatter of a page.

Resolves #31
refs/notes/semantic-release-v1.5.0
semantic-release-bot <semantic-release-bot@martynus.net>
Wednesday, August 7, 2024 08:50 +0200
{"channels":[null]}
2 files added
4 files modified
29 ■■■■■ changed files
README.md 11 ●●●●● patch | view | raw | blame | history
layouts/_default/baseof.html 4 ●●●● patch | view | raw | blame | history
tests/exampleSiteWithImage/content/no-image.md 6 ●●●●● patch | view | raw | blame | history
tests/exampleSiteWithImage/urls.txt 1 ●●●● patch | view | raw | blame | history
tests/exampleSiteWithVideo/content/no-video.md 6 ●●●●● patch | view | raw | blame | history
tests/exampleSiteWithVideo/urls.txt 1 ●●●● patch | view | raw | blame | history
README.md
@@ -76,6 +76,15 @@
  position = "center center"
```
You can control displaying of the image on a per-page basis by configuring `visual.image.enable` on each respective page's FrontMatter:
```markdown
+++
visual.image.enable = false
+++
# Privacy statement
```
### Use a video
@@ -85,6 +94,8 @@
You can either use a video that you host or one that is on YouTube.
Just like with [an image](#use-an-image) you can not display a video altogether on particular pages by setting `visual.video.enable = false` in the page's FrontMatter.
##### Use your own video
Add your video to the `static` folder and change `file` to the location of your video accordingly. Make sure you delete `youtubeId` or comment it out.
layouts/_default/baseof.html
@@ -10,14 +10,14 @@
  <div class="fs-split">
    <!-- Image -->
    {{ if .Site.Params.visual.image.enable }}
    {{ if .Params.visual.image.enable | default .Site.Params.visual.image.enable }}
      <div class="split-image">
      </div>
    <!-- Video -->
    {{ else if .Site.Params.visual.video.enable }}
    {{ else if .Params.visual.video.enable | default .Site.Params.visual.video.enable }}
      {{ partial "video" . }}
tests/exampleSiteWithImage/content/no-image.md
New file
@@ -0,0 +1,6 @@
+++
title = "No image"
visual.image.enable = false
+++
Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed cursus turpis vitae tortor. Donec posuere vulputate arcu. Phasellus accumsan cursus velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis orci.
tests/exampleSiteWithImage/urls.txt
@@ -1,3 +1,4 @@
http://hugo:1313/index.html
http://hugo:1313/commonmark.html
http://hugo:1313/long-text.html
http://hugo:1313/no-image.html
tests/exampleSiteWithVideo/content/no-video.md
New file
@@ -0,0 +1,6 @@
+++
title = "No video"
visual.video.enable = false
+++
Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed cursus turpis vitae tortor. Donec posuere vulputate arcu. Phasellus accumsan cursus velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis orci.
tests/exampleSiteWithVideo/urls.txt
@@ -1,3 +1,4 @@
http://hugo:1313/index.html
http://hugo:1313/commonmark.html
http://hugo:1313/long-text.html
http://hugo:1313/no-video.html