Skip to content

Commit 122cb12

Browse files
1v9ivan-nginx
authored andcommitted
Feat: Add language option to creative_commons (#628)
* Update _config.yml * Update sidebar.swig * Update post-copyright.swig
1 parent c9f81b6 commit 122cb12

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

_config.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,15 @@ footer:
9999

100100
# Creative Commons 4.0 International License.
101101
# See: https://creativecommons.org/share-your-work/licensing-types-examples
102-
# Available values: by | by-nc | by-nc-nd | by-nc-sa | by-nd | by-sa | zero
102+
# Available values of license: by | by-nc | by-nc-nd | by-nc-sa | by-nd | by-sa | zero
103+
# You can set a language value if you prefer a translated version of CC license.
104+
# CC licenses are available in 39 languages, where you can find the specific and correct abbreviation you need.
105+
# Valid values of language: deed.zh, deed.fr, deed.de , etc.
103106
creative_commons:
104107
license: by-nc-sa
105108
sidebar: false
106109
post: false
110+
language:
107111

108112

109113
# ---------------------------------------------------------------

layout/_macro/sidebar.swig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,11 @@
112112

113113
{% if theme.creative_commons.license and theme.creative_commons.sidebar %}
114114
<div class="cc-license motion-element" itemprop="license">
115+
{% set ccLanguage = theme.creative_commons.language %}
115116
{% if theme.creative_commons.license === 'zero' %}
116-
{% set ccType = 'publicdomain/zero/1.0/' %}
117+
{% set ccType = 'publicdomain/zero/1.0/' + ccLanguage %}
117118
{% else %}
118-
{% set ccType = 'licenses/' + theme.creative_commons.license + '/4.0/' %}
119+
{% set ccType = 'licenses/' + theme.creative_commons.license + '/4.0/' + ccLanguage %}
119120
{% endif %}
120121
{% set ccURL = 'https://creativecommons.org/' + ccType %}
121122
{% set ccImage = '<img src="' + url_for(theme.images + '/cc-' + theme.creative_commons.license + '.svg') + '" alt="Creative Commons"/>' %}

layout/_partials/post/post-copyright.swig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{% set ccLicense = theme.creative_commons.license | lower %}
2+
{% set ccLanguage = theme.creative_commons.language %}
23
{% set ccIcon = '<i class="fa fa-fw fa-creative-commons"></i>' %}
34
{% set ccText = ccLicense | upper %}
45
{% if ccLicense === 'zero' %}
5-
{% set ccType = 'publicdomain/zero/1.0/' %}
6+
{% set ccType = 'publicdomain/zero/1.0/' + ccLanguage %}
67
{% else %}
7-
{% set ccType = 'licenses/' + ccLicense + '/4.0/' %}
8+
{% set ccType = 'licenses/' + ccLicense + '/4.0/' + ccLanguage %}
89
{% endif %}
910
{% set ccURL = 'https://creativecommons.org/' + ccType %}
1011

0 commit comments

Comments
 (0)