aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--exampleSite/config.yml11
-rw-r--r--layouts/partials/docs/git-footer.html15
-rw-r--r--static/svg/code-merge.svg1
3 files changed, 21 insertions, 6 deletions
diff --git a/exampleSite/config.yml b/exampleSite/config.yml
index 4a81e1f..c2a50a6 100644
--- a/exampleSite/config.yml
+++ b/exampleSite/config.yml
@@ -7,6 +7,7 @@ theme: hugo-book
# Book configuration
disablePathToLower: true
+enableGitInfo: false
params:
# show or hide table of contents for page
@@ -14,12 +15,16 @@ params:
# Set bundle to render side menu
# if not specified file structure and weights will be used
- BookMenuBundle: /menu
+ BookMenuBundle: /menu
# specify section of content to render as menu
# if bookMenuBundle is not set, 'docs' is value by default
BookSection: docs
+ # Set source repository location.
+ # Used for 'Last Modified' and 'Edit this page' links.
+ BookRepo: https://github.com/alex-shpak/hugo-book
+
# Enable "Edit this page" links for 'doc' page type.
- # Disabled by default. Uncomment to enable.
- # BookEditURL: https://github.com/alex-shpak/hugo-book/edit/master/exampleSite/content/
+ # Disabled by default. Uncomment to enable. Requires 'BookRepo' param.
+ # BookEditPath: edit/master/exampleSite/content
diff --git a/layouts/partials/docs/git-footer.html b/layouts/partials/docs/git-footer.html
index d7e34b8..b9bcd39 100644
--- a/layouts/partials/docs/git-footer.html
+++ b/layouts/partials/docs/git-footer.html
@@ -1,9 +1,18 @@
-{{ with .Site.Params.BookEditURL }}
-<div class="align-center book-git-footer justify-end">
+{{ if or .GitInfo .Site.Params.BookEditPath }}
+<div class="align-center book-git-footer {{ if not .GitInfo }}justify-end{{ else }}justify-between{{ end }}">
+ {{ with .GitInfo }}
<div>
- <a href="{{ . }}{{ $.File.Path }}" target="_blank" rel="noopener">
+ <a href="{{ $.Site.Params.BookRepo }}/commit/{{ .Hash }}" title='Last modified {{ .AuthorDate.Local.Format "January 2, 2006 15:04 MST" }} by {{ .AuthorName }}' target="_blank" rel="noopener">
+ <img src="{{ "svg/code-merge.svg" | absURL }}" /> {{ .AuthorDate.Local.Format "Last Modified Jan 2, 2006" }}
+ </a>
+ </div>
+ {{ end }}
+ {{ with .Site.Params.BookEditPath }}
+ <div>
+ <a href="{{ $.Site.Params.BookRepo }}/{{ . }}/{{ $.File.Path }}" target="_blank" rel="noopener">
<img src="{{ "svg/code-fork.svg" | absURL }}" /> Edit this page
</a>
</div>
+ {{ end }}
</div>
{{ end }}
diff --git a/static/svg/code-merge.svg b/static/svg/code-merge.svg
new file mode 100644
index 0000000..3dcf867
--- /dev/null
+++ b/static/svg/code-merge.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M5 18.184v-11.368c1.163-.413 2-1.511 2-2.816 0-1.657-1.343-3-3-3s-3 1.343-3 3c0 1.305.837 2.403 2 2.816v11.367c-1.163.414-2 1.512-2 2.817 0 1.657 1.343 3 3 3s3-1.343 3-3c0-1.305-.837-2.403-2-2.816zm-2.8-14.184c0-.993.807-1.8 1.8-1.8s1.8.807 1.8 1.8-.807 1.8-1.8 1.8-1.8-.807-1.8-1.8zm1.8 18.8c-.993 0-1.8-.807-1.8-1.8s.807-1.8 1.8-1.8 1.8.807 1.8 1.8-.807 1.8-1.8 1.8zm17-4.616v-11.184c0-2.206-1.794-4-4-4h-3v-3l-4 4 4 4v-3h3c1.103 0 2 .897 2 2v11.184c-1.163.413-2 1.512-2 2.816 0 1.657 1.343 3 3 3s3-1.343 3-3c0-1.305-.837-2.403-2-2.816zm-1 4.616c-.993 0-1.8-.807-1.8-1.8s.807-1.8 1.8-1.8 1.8.807 1.8 1.8-.807 1.8-1.8 1.8z"/></svg> \ No newline at end of file