From 2c51bf70349fcf3494b95048d9ef8886ecfbe1b5 Mon Sep 17 00:00:00 2001 From: "jiezhi.xiao" Date: Sat, 30 Mar 2024 12:19:48 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20resolves=20#265,=20add=20su?= =?UTF-8?q?pport=20for=20tranlated=20post?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 15 +++++++++++++++ languages/default.yml | 3 +++ languages/en.yml | 3 +++ layout/post.ejs | 6 ++++++ 4 files changed, 27 insertions(+) diff --git a/README.md b/README.md index d156ed50..bfffefa0 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,7 @@ theme: archer - [设置文章版权信息](https://github.com/fi3ework/hexo-theme-archer/wiki/%E8%AE%BE%E7%BD%AE%E6%96%87%E7%AB%A0%E7%89%88%E6%9D%83%E4%BF%A1%E6%81%AF) - [启用 Algolia 搜索](https://github.com/fi3ework/hexo-theme-archer/wiki/%E5%90%AF%E7%94%A8-Algolia-%E6%90%9C%E7%B4%A2) - [切换为英文界面](https://github.com/fi3ework/hexo-theme-archer/wiki/%E8%8B%B1%E6%96%87%E7%95%8C%E9%9D%A2) +- [翻译的文章](#翻译的文章) ### 启用字数统计 @@ -281,6 +282,20 @@ custom_font: `url` 为引入的自定义字体的 CDN 链接或本地链接。 +### 翻译的文章 + +在文章的 Front-matter 中添加 `translated` 字段,以显示翻译信息。 + +``` markdown +--- +translated: + author: 'Stark-X' + title: '你好,世界' + link: 'https://github.com' +--- +``` + + ## 文章撰写增强 Archer 主题为您撰写的文章提供了一些增强的展示内容。 diff --git a/languages/default.yml b/languages/default.yml index 8c4ba073..aa3b7402 100644 --- a/languages/default.yml +++ b/languages/default.yml @@ -6,3 +6,6 @@ publish_date: 发表日期 update_date: 更新日期 license: 版权声明 read_more: 阅读全文 +original_post_link: 源文章链接 +original_post_author: 源文章作者 +translater: 译者 diff --git a/languages/en.yml b/languages/en.yml index c14c548a..aeb1e60d 100644 --- a/languages/en.yml +++ b/languages/en.yml @@ -6,3 +6,6 @@ publish_date: 'Publish date' update_date: 'Update date' license: 'License' read_more: 'READ ARTICLE' +original_post_link: 'Original post link' +original_post_author: 'Original post author' +translater: 'Translater' diff --git a/layout/post.ejs b/layout/post.ejs index fe910b68..067dd4e5 100644 --- a/layout/post.ejs +++ b/layout/post.ejs @@ -5,7 +5,13 @@ <% if(theme.copyright.enable === true && page.copyright !== false) { %>
+ <% if(page.translated) { %> +

<%- __('translater') %>:<%- config.author %> +

<%- __('original_post_author') %>:<%- page.translated.author %> +

<%- __('original_post_link') %>:<%- page.translated.title || page.translated.link %> + <% } else { %>

<%- __('author') %>:<%- config.author %> + <% } %>

<%- __('post_link') %>:<%- page.permalink %>

<%- __('publish_date') %>:<%- (page.date).format('MMMM Do YYYY, h:mm:ss a') %>

<%- __('update_date') %>:<%- (page.updated).format('MMMM Do YYYY, h:mm:ss a') %>