Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Show photo capture date in lightbox #83

Open
rjwisloff opened this issue Sep 3, 2024 · 1 comment
Open

Feature request: Show photo capture date in lightbox #83

rjwisloff opened this issue Sep 3, 2024 · 1 comment

Comments

@rjwisloff
Copy link

rjwisloff commented Sep 3, 2024

Adding this in gallery.html after the end of the <figure> tag and before the <meta itemprop...> tag will add the date of capture to the text next to the photo:

<span class="pswp-caption-content">
    {{ with .Title }}{{ . }}<br /><hr />{{ end }}
    {{ with .Date }}{{ . | time.Format ":date_short" }}{{ end }}
 </span>

I tried making this dependent on a parameter setting in hugo.toml, but for some reason e.g. .Site.Params.showDate is not picked up in this section. Perhaps there are scope limitations.

@rjwisloff
Copy link
Author

This should work:

In hugo.toml add under [params]a line

   showDate = 'Yes'

and change the section mentioned above to

<span class="pswp-caption-content">
     {{ with .Title }}{{ . }}<br /><hr />{{ end }}
     {{ if eq $.Site.Params.showDate "Yes" }} 
        {{ with .Date }}{{ . | time.Format ":date_short" }}{{ end }}
     {{ end }}
</span>

Setting showDate = 'No' or whatever else than 'Yes' disables showing the date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant