Merge pull request #127 from ottlinger/patch-3

#126: Provide option to show GitInfo in footer
This commit is contained in:
zjedi 2023-03-30 12:33:57 +02:00 committed by GitHub
commit 85b56d39d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 8 deletions

View file

@ -7,7 +7,7 @@ For live demo of master branch, please visit https://zjedi.github.io/hugo-scroll
As a fallback, see a screenshot which may be a bit outdated: ![Screenshot Hugo Scroll Theme](https://raw.githubusercontent.com/zjedi/hugo-scroll/master/images/tn.png) As a fallback, see a screenshot which may be a bit outdated: ![Screenshot Hugo Scroll Theme](https://raw.githubusercontent.com/zjedi/hugo-scroll/master/images/tn.png)
## Installation ## Installation
If you already have a hugo site on your machine, you can simply add this theme via If you already have a Hugo site on your machine, you can simply add this theme via
``` ```
git submodule add https://github.com/zjedi/hugo-scroll.git themes/hugo-scroll git submodule add https://github.com/zjedi/hugo-scroll.git themes/hugo-scroll
``` ```
@ -24,7 +24,7 @@ For more information, read the official [Hugo setup guide][hugo-setup-guide].
If you are starting fresh, simply copy over the contents of the `exampleSite`-directory included in this theme to your source directory. That should give you a good idea about how things work, and then you can go on from there to make the site your own. If you are starting fresh, simply copy over the contents of the `exampleSite`-directory included in this theme to your source directory. That should give you a good idea about how things work, and then you can go on from there to make the site your own.
Please check out the [config.toml](https://github.com/zjedi/hugo-scroll/blob/master/exampleSite/config.toml) included on the [exampleSite](https://github.com/zjedi/hugo-scroll/tree/master/exampleSite) of this theme. Please check out the [config.toml](https://github.com/zjedi/hugo-scroll/blob/master/exampleSite/config.toml) included in the [exampleSite](https://github.com/zjedi/hugo-scroll/tree/master/exampleSite) of this theme.
You can add **a new section to the homepage** by running `hugo new homepage/my-new-content.md` (or craft the file manually) You can add **a new section to the homepage** by running `hugo new homepage/my-new-content.md` (or craft the file manually)
@ -36,14 +36,16 @@ This theme includes the full set of [Fork Awesome 1.2.0 Icons][fork-awesome-icon
```markdown ```markdown
Look at this nice »envelope«-icon: `{{<icon class="fa fa-envelope">}}`. I took this from https://forkaweso.me/Fork-Awesome/icon/envelope/ :-) Look at this nice »envelope«-icon: `{{<icon class="fa fa-envelope">}}`. I took this from https://forkaweso.me/Fork-Awesome/icon/envelope/ :-)
``` ```
### Header logo ### Header logo
Configured in `_index.md`, see `exampleSite`: `header_logo: "images/chef-hat.png"` Configured in `_index.md`, see `exampleSite`: `header_logo: "images/chef-hat.png"`
### External links ### Footer version information
You can add external link in the menu, see `external.md` in the `exampleSite`. In order to see technical version information (extracted from Hugo's [GitInfo](https://gohugo.io/variables/git/))) set the following general option in your config.toml: `enableGitInfo = true`
You can also use `extlink` shortcode to create a link opening in new tab: ### External links
You can add external links in the menu, see `external.md` in the `exampleSite`.
You can also use `extlink` shortcode to create a link opening in a new tab:
```markdown ```markdown
Visit as at {{<extlink text="Instagram" href="https://www.instagram.com/yourInstagramName/">}} Visit as at {{<extlink text="Instagram" href="https://www.instagram.com/yourInstagramName/">}}
``` ```

View file

@ -11,6 +11,9 @@ theme = "hugo-scroll"
# The browser tab name # The browser tab name
title = "Jane Doe - Nutrition Coach & Chef Consultant" title = "Jane Doe - Nutrition Coach & Chef Consultant"
# In order to add version information in the page's footer set to true.
# enableGitInfo = true
# Theme-specific variables `.Site.Params.myParamName` # Theme-specific variables `.Site.Params.myParamName`
[params] [params]

View file

@ -4,13 +4,18 @@
<section class="copyright">{{ . | safeHTML }}</section> <section class="copyright">{{ . | safeHTML }}</section>
{{ end }} {{ end }}
<section>{{ echoParam .Site.Params "hidebyline" }}</section>
{{ if ne .Site.Params.hidedesignbyline true }} {{ if ne .Site.Params.hidedesignbyline true }}
<section> <section>
<a href="https://themes.gohugo.io/hugo-scroll/" target="_blank" rel="noopener">Hugo Scroll</a> template <a href="https://themes.gohugo.io/hugo-scroll/" target="_blank" rel="noopener">Hugo Scroll</a> template
</section> </section>
{{ end }} {{ end }}
{{ if ne .Params.enableGitInfo false }}
{{- if $.GitInfo -}}
<section>
version: {{ .Lastmod.Format "2006-01-02" }} | #{{ .GitInfo.AbbreviatedHash }}
</section>
{{- end -}}
{{ end }}
</div> </div>
</footer> </footer>