From ea2cac77bbb0b01b42e4c50acf733056141fcd83 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 4 Nov 2021 19:32:06 +0300 Subject: pick up default site.settings values from site.github Also, use the default filter more, it's much more convenient. --- README.md | 5 ++++- _config.yml | 13 ++++--------- _includes/common/footer.html | 2 +- _includes/common/header.html | 24 ++++++++++++++++++------ _includes/common/navbar.html | 28 ++++++++++++---------------- _includes/common/sidebar.html | 17 +++++++++++++++-- 6 files changed, 54 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index dc1a448..cfb8eec 100644 --- a/README.md +++ b/README.md @@ -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 @@
-
This project is licensed under the terms of the {{ site.settings.project.license }}. See License for details.
+
This project is licensed under the terms of the {{ site.settings.project.license | default: 'MIT License' }}. See License for details.
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 @@ - {% 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 @@