feat(layout): add article licensing block

This commit is contained in:
ppoffice 2020-08-29 00:42:43 -04:00
parent f6f51dd83b
commit 3c9a6ca645
No known key found for this signature in database
GPG Key ID: B33335481CC0D498
18 changed files with 143 additions and 1 deletions

View File

@ -39,6 +39,26 @@
"description": "Whether to show estimated article reading time",
"default": true,
"nullable": true
},
"licenses": {
"$ref": "/misc/article_licensing.json",
"description": "Article licensing block",
"examples": [
{
"Creative Commons": {
"icon": "fab fa-creative-commons",
"url": "https://creativecommons.org/"
},
"Attribution": {
"icon": "fab fa-creative-commons-by",
"url": "https://creativecommons.org/licenses/by/4.0/"
},
"Noncommercial": {
"icon": "fab fa-creative-commons-nc",
"url": "https://creativecommons.org/licenses/by-nc/4.0/"
}
}
]
}
}
}

View File

@ -99,3 +99,51 @@ article
left: 0
width: 100%
height: 100%
.article-licensing
position: relative
z-index: 1
box-shadow: none
background: $white-ter
border-radius: $radius
overflow: hidden
&:after
position: absolute
z-index: -1
right: -50px
top: -87.87px
content: '\f25e'
font-size: 200px
font-family: 'Font Awesome 5 Brands'
opacity: 0.1
.level-left
flex-wrap: wrap
max-width: 100%
.licensing-title
@extend .mb-3
line-height: 1.2
p:not(:last-child)
@extend .mb-1
a
@extend .size-small, .has-text-grey
.licensing-meta
.level-item
@extend .mr-4
.icon
@extend .mr-1
width: 1.2em
height: 1.2em
font-size: 1.2em
h6
@extend .size-small
a
@extend .has-text-black

View File

@ -33,6 +33,11 @@ article:
word_count:
one: 'Über %d Wort'
other: 'Über %d Wörter'
licensing:
author: 'Author'
created_at: 'Posted on'
updated_at: 'Updated on'
licensed_under: 'Licensed under'
donate:
title: 'Gefällt Ihnen der Artikel? Unterstützen Sie den Autor mit'
afdian: 'Afdian.net'

View File

@ -33,6 +33,11 @@ article:
word_count:
one: 'About %d word'
other: 'About %d words'
licensing:
author: 'Author'
created_at: 'Posted on'
updated_at: 'Updated on'
licensed_under: 'Licensed under'
donate:
title: 'Like this article? Support the author with'
afdian: 'Afdian.net'

View File

@ -34,6 +34,11 @@ article:
word_count:
one: 'Aproximadamente %d palabra'
other: 'Aproximadamente %d palabras'
licensing:
author: 'Author'
created_at: 'Posted on'
updated_at: 'Updated on'
licensed_under: 'Licensed under'
donate:
title: '¿Te gusta este artículo? Apoya al autor con'
afdian: 'Afdian.net'

View File

@ -33,6 +33,11 @@ article:
word_count:
one: 'Environ %d mot'
other: 'Environ %d mots'
licensing:
author: 'Author'
created_at: 'Posted on'
updated_at: 'Updated on'
licensed_under: 'Licensed under'
donate:
title: "Vous aimez cet article? Soutenez l'auteur avec"
afdian: 'Afdian.net'

View File

@ -33,6 +33,11 @@ article:
word_count:
one: 'Sekitar %d kata'
other: 'Sekitar %d kata'
licensing:
author: 'Author'
created_at: 'Posted on'
updated_at: 'Updated on'
licensed_under: 'Licensed under'
donate:
title: 'Suka dengan artikel ini? Bantu penulis dengan donasi melalui'
afdian: 'Afdian.net'

View File

@ -33,6 +33,11 @@ article:
word_count:
one: '約%d語'
other: '約%d語'
licensing:
author: 'Author'
created_at: 'Posted on'
updated_at: 'Updated on'
licensed_under: 'Licensed under'
donate:
title: 'この記事は気に入りましたか? 著者をサポートする'
afdian: 'Afdian.net'

View File

@ -33,6 +33,11 @@ article:
word_count:
one: '약 %d 단어'
other: '약 %d 단어'
licensing:
author: 'Author'
created_at: 'Posted on'
updated_at: 'Updated on'
licensed_under: 'Licensed under'
donate:
title: '이 기사처럼? 저자 지원'
afdian: 'Afdian.net'

View File

@ -33,6 +33,11 @@ article:
word_count:
one: 'Około %d słowa'
other: 'Około %d słów'
licensing:
author: 'Author'
created_at: 'Posted on'
updated_at: 'Updated on'
licensed_under: 'Licensed under'
donate:
title: 'Podoba Ci się ten artykuł? Wesprzyj autora za pomocą'
afdian: 'Afdian.net'

View File

@ -33,6 +33,11 @@ article:
word_count:
one: 'Cerca de %d palavra'
other: 'Cerca de %d palavras'
licensing:
author: 'Author'
created_at: 'Posted on'
updated_at: 'Updated on'
licensed_under: 'Licensed under'
donate:
title: 'Gostou deste artigo? Apoie o autor com'
afdian: 'Afdian.net'

View File

@ -33,6 +33,11 @@ article:
word_count:
one: 'Около %d слова'
other: 'Примерно %d слова'
licensing:
author: 'Author'
created_at: 'Posted on'
updated_at: 'Updated on'
licensed_under: 'Licensed under'
donate:
title: 'Понравилась эта статья? Поддержите автора'
afdian: 'Afdian.net'

View File

@ -33,6 +33,11 @@ article:
word_count:
one: 'Yaklaşık %d kelime'
other: 'Yaklaşık %d kelime'
licensing:
author: 'Author'
created_at: 'Posted on'
updated_at: 'Updated on'
licensed_under: 'Licensed under'
donate:
title: 'Bu makaleyi beğendiniz mi? Yazarı şununla destekleyin'
afdian: 'Afdian.net'

View File

@ -33,6 +33,11 @@ article:
word_count:
one: 'Khoảng %d từ'
other: 'Khoảng %d từ'
licensing:
author: 'Author'
created_at: 'Posted on'
updated_at: 'Updated on'
licensed_under: 'Licensed under'
donate:
title: 'Bạn đọc có thể ủng hộ blog qua'
afdian: 'Afdian.net'

View File

@ -33,6 +33,11 @@ article:
word_count:
one: '大约%d个字'
other: '大约%d个字'
licensing:
author: '作者'
created_at: '发布于'
updated_at: '更新于'
licensed_under: '许可协议'
donate:
title: '喜欢这篇文章?打赏一下作者吧'
afdian: '爱发电'

View File

@ -33,6 +33,11 @@ article:
word_count:
one: '大約%d個字'
other: '大約%d個字'
licensing:
author: '作者'
created_at: '發表於'
updated_at: '更新於'
licensed_under: '許可協議'
donate:
title: '喜歡這篇文章嗎? 贊助一下作者吧!'
afdian: '愛發電'

View File

@ -3,6 +3,7 @@ const { Component, Fragment } = require('inferno');
const Share = require('./share');
const Donates = require('./donates');
const Comment = require('./comment');
const ArticleLicensing = require('hexo-component-inferno/lib/view/misc/article_licensing');
/**
* Get the word count of text.
@ -84,6 +85,9 @@ module.exports = class extends Component {
</h1>
{/* Content/Excerpt */}
<div class="content" dangerouslySetInnerHTML={{ __html: index && page.excerpt ? page.excerpt : page.content }}></div>
{/* Licensing block */}
{!index && article && article.licenses && Object.keys(article.licenses)
? <ArticleLicensing.Cacheable page={page} config={config} helper={helper} /> : null}
{/* Tags */}
{!index && page.tags && page.tags.length ? <div class="article-tags size-small mb-4">
<span class="mr-2">#</span>

View File

@ -30,7 +30,7 @@
"bulma-stylus": "0.8.0",
"deepmerge": "^4.2.2",
"hexo": "^5.0.2",
"hexo-component-inferno": "^0.7.0",
"hexo-component-inferno": "^0.8.0",
"hexo-log": "^2.0.0",
"hexo-pagination": "^1.0.0",
"hexo-renderer-inferno": "^0.1.3",