Suggestions to help integrate in a theme
Closed this issue · 2 comments
Hi again,
For future reference if someone wants to include hps in casper theme. The current casper theme supposes that all posts are in the "post" section. Therefore, I needed to create galleries in /content/post/galleries
. In order to handle the differences in html file, I chose to add a "gallery"
tag and then use the following approach: e.g. in footer.html
:
<!-- photoswipe -->
{{ if in .Params.tags "gallery" }}
<script type="application/javascript" src="{{ .Site.BaseURL }}js/photoswipe.min.js"></script>
<script type="application/javascript" src="{{ .Site.BaseURL }}js/photoswipe-ui-default.min.js"></script>
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
{{ end }}
I had planned to add the "gallery" tag to my posts anyway so this works fine for me.
What I would like is for hps to handle the setting of custom lines in the TOML front matter or even a short description (for a nicer front page).
Today, hps provides a .md file that I can modify to my liking. But running hps update
rewrites the .md gallery file (even if there are no modifications to the gallery file) and I have to start over.
catkfr
Currently HugoPhotoSwipe already allows adding custom lines in the TOML. Anything added as a subfield of the properties
tag in the album.yml
file ends up in the frontmatter of the markdown file. I've added some documentation on this in the Wiki here.
With the latest update of HugoPhotoSwipe (version 0.0.12), all properties are now wrapped in triple-quoted strings in the TOML, so newlines are preserved. Combining this with the markdownify
function of Hugo allows you to do whatever you like with your galleries. Hope this helps!
Great!
Thanks a lot!