diff options
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | _config.yml | 13 | ||||
-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 |
6 files changed, 54 insertions, 35 deletions
@@ -28,7 +28,7 @@ Put it in \_config.yml and adjust how you see fit. ``` settings: project: - name: Test + name: Test project description: This is a test project license: MIT License license_file: LICENSE.txt @@ -37,6 +37,9 @@ settings: email: John.Doe@example.com navbar: hide: false + github: # Only relevant if you use jekyll-github-metadata/github-pages + link: GitHub + icon: globe ``` Features diff --git a/_config.yml b/_config.yml index 4ac283e..5542d59 100644 --- a/_config.yml +++ b/_config.yml @@ -43,13 +43,8 @@ paginate_path: '/feed/page:num/' # Theme settings settings: - project: - name: jekyll-theme - description: jekyll-theme preview - license: MIT License - license_file: LICENSE.txt author: - name: John Doe - email: John.Doe@example.com - navbar: - hide: false + # jekyll-github-metadata doesn't include the display name or the email + # address of the owner. + name: Egor Tensin + email: Egor.Tensin@gmail.com 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"> |