feat: support copyright placeholders/variables (#46)

* feat: re-format copyright message and auto increase current year

* docs: add comment for copyright setting

This comment is crucial, especially for newcomers.

* refactor: better liquid code format

Co-authored-by: jeffreytse <jeffreytse.mail@gmail.com>
This commit is contained in:
Yuchen Zhang 2021-06-28 19:31:58 -07:00 committed by GitHub
parent 4e3e599bbf
commit b3e6ee2f69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 2 deletions

View file

@ -2,3 +2,4 @@
source "https://rubygems.org" source "https://rubygems.org"
gemspec gemspec

View file

@ -27,7 +27,21 @@
title: Your awesome title title: Your awesome title
email: your-email@domain.com email: your-email@domain.com
author: GitHub User author: GitHub User
copyright: Copyright © 1970-2010
# Copyright setting
# You can use any html code, currently below placeholders are available:
# * current year: {currentYear}
# * author: {author} (Value is the same as site.author)
# * copyright: (c) - ©
# * copyleft: (cleft)
# * sound recording copyright: (p) - ℗
#
# For example:
# "Copyright (c) 2017-{currentYear} <a href="https://example.com">{author}</a>"
# "Copyright © 2017-2021 Foobar"
#
copyright: "Unpublished Work (cleft) 2017-{currentYear} {author}"
description: >- # this means to ignore newlines until "baseurl:" description: >- # this means to ignore newlines until "baseurl:"
Write an awesome description for your new site here. You can edit this Write an awesome description for your new site here. You can edit this
line in _config.yml. It will appear in your document head meta (for line in _config.yml. It will appear in your document head meta (for

View file

@ -3,7 +3,15 @@
<div class="wrapper"> <div class="wrapper">
<div class="site-footer-inner"> <div class="site-footer-inner">
<div>{{ site.copyright }} {% if site.author %}@{{ site.author | escape }}{% endif %}</div> <div>
{%- assign currYear = 'now' | date: "%Y" -%}
{{ site.copyright
| replace: '{currentYear}', currYear
| replace: '{author}', site.author
| replace: '(c)', '&copy;'
| replace: '(p)', '℗'
| replace: '(cleft)', '<span class="copyleft">&copy;</span>'
}}</div>
<div>Powered by <a title="Jekyll is a simple, blog-aware, static site <div>Powered by <a title="Jekyll is a simple, blog-aware, static site
generator." href="http://jekyllrb.com/">Jekyll</a> &amp; <a title="Yat, yet generator." href="http://jekyllrb.com/">Jekyll</a> &amp; <a title="Yat, yet
another theme." href="https://github.com/jeffreytse/jekyll-theme-yat">Yat Theme</a>.</div> another theme." href="https://github.com/jeffreytse/jekyll-theme-yat">Yat Theme</a>.</div>

View file

@ -210,6 +210,11 @@ html {
} }
} }
.copyleft {
display: inline-block;
transform: rotate(180deg);
}
/** /**
* Post header * Post header
*/ */