aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-11-02 20:57:05 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-11-02 21:01:14 +0300
commit513dd2010502a4519db11bf6f54584047b024949 (patch)
tree520b57424c366f8ef7239269caa1049a1ae232a3
parentbump dependencies (diff)
downloadjekyll-theme-513dd2010502a4519db11bf6f54584047b024949.tar.gz
jekyll-theme-513dd2010502a4519db11bf6f54584047b024949.zip
navbar: add a GitHub link
Diffstat (limited to '')
-rw-r--r--README.md7
-rw-r--r--_includes/common/navbar.html18
2 files changed, 25 insertions, 0 deletions
diff --git a/README.md b/README.md
index 291b79d..a719f6d 100644
--- a/README.md
+++ b/README.md
@@ -62,6 +62,13 @@ something like `home` or `envelope` (or [any other glyphicon]).
[any other glyphicon]: https://getbootstrap.com/docs/3.4/components/#glyphicons
+If you use `jekyll-github-metadata` (you do if you use the `github-pages` gem),
+a link to the GitHub repository is added at the end of the navbar.
+Customize the link text and the icon by setting
+`site.settings.navbar.github.link` and `site.settings.navbar.github.icon`
+accordingly.
+Hide the link by settings `site.settings.navbar.github` to `false`.
+
### Post feed
See [feed/index.html] for an example of how to easily create a paginated post
diff --git a/_includes/common/navbar.html b/_includes/common/navbar.html
index 7e5fa4e..2002bd0 100644
--- a/_includes/common/navbar.html
+++ b/_includes/common/navbar.html
@@ -44,6 +44,24 @@
<li><a href="{{ node.url | relative_url }}">{{ icon }}{{ link }}</a></li>
{% endif %}
{% endfor %}
+
+ {% if site.github %}
+ {% assign github_link = 'GitHub' %}
+ {% assign github_icon = 'globe' %}
+ {% if site.settings.navbar.github %}
+ {% if site.settings.navbar.github.link %}
+ {% assign github_link = site.settings.navbar.github.link %}
+ {% endif %}
+ {% if site.settings.navbar.github.icon %}
+ {% assign github_icon = site.settings.navbar.github.icon %}
+ {% endif %}
+ {% endif %}
+ {% capture github_icon %}<span class="glyphicon glyphicon-{{ github_icon }}"></span>&nbsp;{% endcapture %}
+ {% if site.settings.navbar.github == false %}
+ {% else %}
+ <li><a href="{{ site.github.repository_url }}">{{ github_icon }}{{ github_link | upcase }}</a></li>
+ {% endif %}
+ {% endif %}
</ul>
</div>
</div>