aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/_includes/common
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-11-11 19:19:53 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-11-11 19:33:12 +0300
commitb911f32d0d8e27e3530bed6ac8d8addcc426e3e4 (patch)
tree701d231adc971d034f1b33299bd23a8e3d758134 /_includes/common
parentposts: use CSS for space between category and date (diff)
downloadjekyll-theme-b911f32d0d8e27e3530bed6ac8d8addcc426e3e4.tar.gz
jekyll-theme-b911f32d0d8e27e3530bed6ac8d8addcc426e3e4.zip
footer: intelligent license detection
Pick up /LICENSE.txt by default, if it exists. Use site.github.license otherwise.
Diffstat (limited to '_includes/common')
-rw-r--r--_includes/common/footer.html33
1 files changed, 30 insertions, 3 deletions
diff --git a/_includes/common/footer.html b/_includes/common/footer.html
index 7b16e98..9bf9c76 100644
--- a/_includes/common/footer.html
+++ b/_includes/common/footer.html
@@ -3,15 +3,42 @@
<div class="footer-wrapper-collapse">
<footer class="navbar-default">
<div class="container">
- <div style="display: table; width: 100%;">
+ <div style="display: table; width: 100%;" class="small">
<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 | default: 'MIT License' }}. See <a href="{{ '/' | relative_url }}{{ site.settings.project.license_file | default: 'LICENSE.txt' }}">License</a> for details.</small></div>
+ <div class="text-center text-muted">
+ {% if site.settings.project.license_file %}
+ {% capture license_file %}{{ '/' | relative_url }}{{ site.settings.project.license_file }}{% endcapture %}
+ {% else %}
+ {% for file in site.static_files %}
+ {% if file.path == '/LICENSE.txt' %}
+ {% assign license_file = file.path | relative_url %}
+ {% endif %}
+ {% endfor %}
+ {% endif %}
+ {% if site.settings.project.license %}
+ {% assign license = site.settings.project.license %}
+ {% unless license_file %}
+ {% capture license_file %}https://spdx.org/licenses/{{ license }}.html{% endcapture %}
+ {% capture license %}{{ license }} License{% endcapture %}
+ {% endunless %}
+ {% elsif site.github.license %}
+ {% assign license = site.github.license.name %}
+ {% unless license_file %}
+ {% capture license_file %}https://spdx.org/licenses/{{ site.github.license.spdx_id }}.html{% endcapture %}
+ {% endunless %}
+ {% endif %}
+ {% if license %}
+ This project is licensed under the <a href="{{ license_file }}">{{ license }}</a>.
+ {% elsif license_file %}
+ This project is licensed under <a href="{{ license_file }}">this license</a>.
+ {% endif %}
+ </div>
</div>
</div>
<div style="display: table-row;">
<div style="display: table-cell;">
- <div class="text-center text-muted"><small>This version of the page was generated on {{ site.time | date: '%-d %B %Y' }}.</small></div>
+ <div class="text-center text-muted">This version of the page was generated on {{ site.time | date: '%-d %B %Y' }}.</div>
</div>
</div>
</div>