diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-11-04 19:32:06 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-11-05 13:01:33 +0300 |
commit | ea2cac77bbb0b01b42e4c50acf733056141fcd83 (patch) | |
tree | 22af069250b139c541dfbd3b3d62c73ca6a94843 /_includes | |
parent | README: fix a typo (diff) | |
download | jekyll-theme-ea2cac77bbb0b01b42e4c50acf733056141fcd83.tar.gz jekyll-theme-ea2cac77bbb0b01b42e4c50acf733056141fcd83.zip |
pick up default site.settings values from site.github
Also, use the default filter more, it's much more convenient.
Diffstat (limited to '_includes')
-rw-r--r-- | _includes/common/footer.html | 2 | ||||
-rw-r--r-- | _includes/common/header.html | 24 | ||||
-rw-r--r-- | _includes/common/navbar.html | 28 | ||||
-rw-r--r-- | _includes/common/sidebar.html | 17 |
4 files changed, 46 insertions, 25 deletions
diff --git a/_includes/common/footer.html b/_includes/common/footer.html index 0d7a2a0..7b16e98 100644 --- a/_includes/common/footer.html +++ b/_includes/common/footer.html @@ -6,7 +6,7 @@ <div style="display: table; width: 100%;"> <div style="display: table-row;"> <div style="display: table-cell;"> - <div class="text-center text-muted"><small>This project is licensed under the terms of the {{ site.settings.project.license }}. See <a href="{{ '/' | relative_url }}{{ site.settings.project.license_file }}">License</a> for details.</small></div> + <div class="text-center text-muted"><small>This project is licensed under the terms of the {{ site.settings.project.license | default: 'MIT License' }}. See <a href="{{ '/' | relative_url }}{{ site.settings.project.license_file | default: 'LICENSE.txt' }}">License</a> for details.</small></div> </div> </div> <div style="display: table-row;"> diff --git a/_includes/common/header.html b/_includes/common/header.html index 81d7cbf..fc99302 100644 --- a/_includes/common/header.html +++ b/_includes/common/header.html @@ -5,10 +5,23 @@ <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> - {% if site.settings.project.name %} - {% capture title %}{{ site.settings.project.name }} - {{ site.settings.author.name }}{% endcapture %} + {% assign project_name = site.settings.project.name %} + {% unless project_name %} + {% if site.github && site.github.is_project_page %} + {% assign project_name = site.github.repository_name %} + {% endif %} + {% endunless %} + {% assign author_name = site.settings.author.name %} + {% unless author_name %} + {% if site.github %} + {% assign author_name = site.github.owner_name %} + {% endif %} + {% endunless %} + {% assign author_name = author_name | default: 'John Doe' %} + {% if project_name %} + {% capture title %}{{ project_name }} - {{ author_name }}{% endcapture %} {% else %} - {% capture title %}{{ site.settings.author.name }}{% endcapture %} + {% capture title %}{{ author_name }}{% endcapture %} {% endif %} {% if page.url != '/' %} {% capture title %}{{ page.title }} - {{ title }}{% endcapture %} @@ -39,11 +52,10 @@ </head> <body> <div class="top-level-footer-wrapper"> - {% if site.settings.navbar.hide or page.navbar.hide %} - {% else %} + {% unless site.settings.navbar.hide or page.navbar.hide %} <div class="footer-wrapper-collapse"> {% include common/navbar.html %} </div> - {% endif %} + {% endunless %} <div class="footer-wrapper-expand"> <div class="container"> diff --git a/_includes/common/navbar.html b/_includes/common/navbar.html index 47ebe6f..8640633 100644 --- a/_includes/common/navbar.html +++ b/_includes/common/navbar.html @@ -7,7 +7,14 @@ <span class="icon-bar"></span> <span class="icon-bar"></span> </button> - <a class="navbar-brand" href="/">{{ site.settings.author.name }}</a> + {% assign author_name = site.settings.author.name %} + {% unless author_name %} + {% if site.github %} + {% assign author_name = site.github.owner_name %} + {% endif %} + {% endunless %} + {% assign author_name = author_name | default: 'John Doe' %} + <a class="navbar-brand" href="/">{{ author_name }}</a> </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> @@ -45,22 +52,11 @@ {% 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 %} + {% if site.github and site.settings.navbar.github != false %} + {% assign github_link = site.settings.navbar.github.link | default: 'GitHub' %} + {% assign github_icon = site.settings.navbar.github.icon | default: 'globe' %} {% capture github_icon %}<span class="glyphicon glyphicon-{{ github_icon }}"></span> {% endcapture %} - {% if site.settings.navbar.github == false %} - {% else %} - <li><a href="{{ site.github.repository_url }}" target="_blank">{{ github_icon }}{{ github_link | upcase }}</a></li> - {% endif %} + <li><a href="{{ site.github.repository_url }}" target="_blank">{{ github_icon }}{{ github_link | upcase }}</a></li> {% endif %} </ul> </div> diff --git a/_includes/common/sidebar.html b/_includes/common/sidebar.html index 6d1d17d..929cabe 100644 --- a/_includes/common/sidebar.html +++ b/_includes/common/sidebar.html @@ -1,10 +1,23 @@ <div class="row"> <div class="col-xs-12 col-sm-6 col-md-12"> <h4>About</h4> - <p>{{ site.settings.project.description }}. Feel free to contribute or contact me.</p> + {% assign project_desc = site.settings.project.description %} + {% unless project_desc %} + {% if site.github %} + {% assign project_desc = site.github.project_tagline %} + {% endif %} + {% endunless %} + {% if project_desc %} + {% capture project_desc %}{{ project_desc }}. {% endcapture %} + {% endif %} + {% capture project_desc %}{{ project_desc }}Feel free to contribute or contact me.{% endcapture %} + <p>{{ project_desc }}</p> <div class="list-group wide-enough"> + {% if site.github %} <a class="list-group-item" href="{{ site.github.repository_url }}"><span class="glyphicon glyphicon-home"></span> GitHub repository</a> - <a class="list-group-item" href="mailto:{{ site.settings.author.email }}"><span class="glyphicon glyphicon-envelope"></span> {{ site.settings.author.email }}</a> + {% endif %} + {% assign author_email = site.settings.author.email | default: 'John.Doe@example.com' %} + <a class="list-group-item" href="mailto:{{ author_email }}"><span class="glyphicon glyphicon-envelope"></span> {{ author_email }}</a> </div> </div> <div class="col-xs-12 col-sm-6 col-md-12"> |