Skip to content

Commit

Permalink
site: add gitinfo and edit links to footer (#525)
Browse files Browse the repository at this point in the history
* pass page variables to footer

* use .GitInfo and .File variables to show something like this in the footer
  for each page:

    [Edit Page] - Built from commit [xxxx]

* enableGitInfo both locally and on Netlify builds

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>

Co-authored-by: Cornelius Weig <22861411+corneliusweig@users.noreply.github.com>
  • Loading branch information
ahmetb and corneliusweig committed Mar 1, 2020
1 parent 2045542 commit 4a1f75c
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 13 deletions.
4 changes: 2 additions & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ HUGO_VERSION = "0.65.1"
HUGO_ENV = "production"

[context.deploy-preview]
command = "hugo --enableGitInfo --buildFuture -b $DEPLOY_PRIME_URL"
command = "hugo --buildFuture -b $DEPLOY_PRIME_URL"

[context.branch-deploy]
command = "hugo --enableGitInfo --buildFuture -b $DEPLOY_PRIME_URL"
command = "hugo --buildFuture -b $DEPLOY_PRIME_URL"
1 change: 1 addition & 0 deletions site/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
title: "Krew – kubectl plugin manager"
baseURL: "https://krew.sigs.k8s.io/"
languageCode: "en-us"
enableGitInfo: true
enableRobotsTXT: true
disableKinds:
- taxonomy
Expand Down
2 changes: 1 addition & 1 deletion site/layouts/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ <h1 class="display-3 text-danger">Not found</h1>

<a href=" {{ "/" }} " class="btn btn-lg btn-primary">&larr; Home</a>

{{ partial "footer.html" }}
{{ partial "footer.html" . }}
2 changes: 1 addition & 1 deletion site/layouts/docs/section.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ <h1>
{{ partial "backbutton.html" .}}
{{ end }}
</article>
{{ partial "footer.html" }}
{{ partial "footer.html" . }}
2 changes: 1 addition & 1 deletion site/layouts/docs/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ <h1>{{.Title}}</h1>
</article>

{{ partial "backbutton.html" .}}
{{ partial "footer.html" }}
{{ partial "footer.html" . }}
2 changes: 1 addition & 1 deletion site/layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@

</article>

{{ partial "footer.html" }}
{{ partial "footer.html" . }}
27 changes: 20 additions & 7 deletions site/layouts/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@

<footer class="text-muted">
<footer class="text-muted small">
<hr/>
<small>
&copy; {{ now.Format "2006"}} The Kubernetes Authors.
Krew documentation is distributed under
<a target="_blank" href='https://creativecommons.org/licenses/by/4.0/' class='text-muted'>CC-BY-4.0</a>.<br/>
Krew is a Kubernetes <a href="https://github.com/kubernetes/community/blob/master/sig-cli/README.md#cli-special-interest-group" target="_blank">SIG CLI</a> project.
</small>
&copy; {{ now.Format "2006"}} The Kubernetes Authors.
Krew is a Kubernetes
<a href="https://github.com/kubernetes/community/blob/master/sig-cli/README.md#cli-special-interest-group" target="_blank" class="text-info">
SIG CLI</a> project.
<p>
{{ with .File }}
<a href="http://sigs.k8s.io/krew/site/content/{{- .File.Path -}}" target="_blank" class="text-info">
Edit Page</a>
{{ end }}

{{ if .GitInfo }}
<strong>&middot;</strong>
Built from commit
<a href="https://github.com/kubernetes-sigs/krew/commit/{{- .GitInfo.Hash -}}"
target="_blank" class="text-muted">
{{- .GitInfo.AbbreviatedHash -}}
</a>.
{{ end}}
</p>
</footer>
</div>
</div><!-- .container -->
Expand Down

0 comments on commit 4a1f75c

Please sign in to comment.