Skip to content

Commit

Permalink
refactor: rename article -> post
Browse files Browse the repository at this point in the history
  • Loading branch information
XPoet committed Dec 1, 2023
1 parent 71c3150 commit 9cac987
Show file tree
Hide file tree
Showing 18 changed files with 125 additions and 147 deletions.
14 changes: 7 additions & 7 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ scroll:
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/home.html
# ---------------------------------------------------------------------------------------
home:
# Show category in home page article block
# Show category in home page post block
category: false # Option values: true | false

# Show tags in home page article block
# Show tags in home page post block
tag: false # Option values: true | false

# Website announcement in home page
Expand All @@ -130,8 +130,8 @@ post:
# Depend on Hexo Plugin: hexo-wordcount (`npm install hexo-wordcount`)
# See: https://github.com/willin/hexo-wordcount
word_count:
wordcount: false # Word count, one article. Option values: true | false
min2read: false # Time to read, one article. Option values: true | false
wordcount: false # Word count, one post. Option values: true | false
min2read: false # Time to read, one post. Option values: true | false

# Post datetime
datetime_format: "YYYY-MM-DD HH:mm:ss" # Datetime format. e.g. "YYYY-MM-DD HH:mm:ss"
Expand Down Expand Up @@ -172,10 +172,10 @@ toc:
# If true, all level of TOC in a post will be displayed, rather than the activated part of it.
expand_all: false # Option values: true | false

# If true, auto open TOC every time when you enter the article page
# If true, auto open TOC every time when you enter post page
init_open: true # Option values: true | false

# TOC layout on article page
# TOC layout on post page
layout: right # Option values: left | right


Expand Down Expand Up @@ -242,7 +242,7 @@ comment:
# https://waline.js.org/guide/get-started.html
waline:
server_url: # Server URL
reaction: false # Article reactions, Option values: true | false
reaction: false # Post reactions, Option values: true | false
version: 2 # Waline version, default use v2

# Giscus
Expand Down
10 changes: 5 additions & 5 deletions languages/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ code_block:
copy_copyright:
copy: Copy copyright info
copied: Copied
title: Original article title
author: Original article author
link: Original article link
title: Original post title
author: Original post author
link: Original post link
copyright:
author: Author
title: Title
Expand All @@ -62,7 +62,7 @@ copyright:
published: Published
license: License
license_title: Copyright notice
license_content: "All articles in this blog are licensed under %s unless stating additionally."
license_content: "All posts in this blog are licensed under %s unless stating additionally."
ago:
second: "%s seconds ago"
minute: "%s minutes ago"
Expand All @@ -86,7 +86,7 @@ footer:
upyun: UPYUN
total_words: Total words
post:
aging: "It has been %s days since the last update of this article. Some contents may be outdated. Please pay attention to screening."
aging: "It has been %s days since the last update of this post. Some contents may be outdated. Please pay attention to screening."
share:
qq: "Share to QQ"
wechat: "Share to WeChat"
Expand Down
8 changes: 4 additions & 4 deletions layout/_partial/archive-list.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<div class="archive-item-header border-box">
<span class="archive-year"><%= postItem.year %></span>
</div>
<ul class="article-list border-box">
<ul class="archive-item-body border-box">
<% postItem.postList.forEach(post => { %>
<li class="article-item border-box">
<span class="article-date border-box"><%= date(post.date, 'MM-DD') %></span>
<a class="article-title border-box text-ellipsis"
<li class="post-item border-box">
<span class="post-date border-box"><%= date(post.date, 'MM-DD') %></span>
<a class="post-title border-box text-ellipsis"
href="<%- url_for(post.path) %>"
><%= post.title %></a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion layout/_partial/post/post-copyright-info.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (config?.language === 'zh-TW') {
licenseLang = '.zh-hant'
}
%>
<div class="article-copyright-info-container border-box">
<div class="post-copyright-info-container border-box">
<div class="copyright-info-content border-box">
<div class="copyright-info-top border-box">
<div class="post-title border-box text-ellipsis">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,30 @@ const home_category_limit_number = 3
const home_tag_limit_number = 5
%>

<div class="article-meta-info-container border-box <%= page_type %>">
<div class="article-meta-info border-box">
<div class="post-meta-info-container border-box <%= page_type %>">
<div class="post-meta-info border-box">
<% if (page_type === 'home') { %>
<span class="meta-info-item border-box">
<i class="icon fas fa-history"></i>&nbsp;<span class="home-article-history" data-updated="<%= post.updated %>"><%= date(post.updated, 'YYYY-MM-DD HH:mm:ss') %></span>
<i class="icon fas fa-history"></i>&nbsp;<span class="home-post-history" data-updated="<%= post.updated %>"><%= date(post.updated, 'YYYY-MM-DD HH:mm:ss') %></span>
</span>
<% } %>


<% if (page_type === 'post') { %>
<span class="meta-info-item article-create-date">
<span class="meta-info-item post-create-date">
<i class="icon fa-solid fa-calendar-check"></i>&nbsp;
<span class="pc"><%= date(post.date, theme.post?.datetime_format || 'YYYY-MM-DD HH:mm:ss') %></span>
<span class="mobile"><%= date(post.date, 'YYYY-MM-DD HH:mm') %></span>
</span>
<span class="meta-info-item article-update-date">
<span class="meta-info-item post-update-date">
<i class="icon fa-solid fa-file-pen"></i>&nbsp;
<span class="pc" data-updated="<%= post.updated %>"><%= date(post.updated, theme.post?.datetime_format || 'YYYY-MM-DD HH:mm:ss') %></span>
</span>
<% } %>
<% if (post.categories.length && (theme?.home?.category === true || page_type === 'post')) { %>
<span class="meta-info-item article-category border-box"><i class="icon fas fa-folder"></i>&nbsp;
<ul class="article-category-ul">
<span class="meta-info-item post-category border-box"><i class="icon fas fa-folder"></i>&nbsp;
<ul class="post-category-ul">
<% post.categories.forEach((category, i) => {
if (home_category_limit_number === 0 || i + 1 <= home_category_limit_number || page_type === 'post') { %>
<li class="category-item"><% if (i !== 0) { %>&nbsp;<i class="icon fas fa-angle-right"></i>&nbsp;<% } %><a href="<%- url_for(category.path) %>"><%= category.name %></a></li>
Expand All @@ -38,9 +37,9 @@ const home_tag_limit_number = 5
<% } %>
<% if (post.tags.length && (theme?.home?.tag === true || page_type === 'post')) { %>
<span class="article-tag meta-info-item border-box">
<span class="post-tag meta-info-item border-box">
<i class="icon fas fa-tags"></i>&nbsp;
<ul class="article-tag-ul">
<ul class="post-tag-ul">
<% post.tags.forEach((tag, i) => {
if (home_tag_limit_number === 0 || i + 1 <= home_tag_limit_number || page_type === 'post') { %>
<li class="tag-item"><span class="tag-separator"><i class="icon fas fa-hashtag"></i></span><a href="<%- url_for(tag.path) %>"><%= tag.name %></a></li>
Expand All @@ -61,17 +60,17 @@ const home_tag_limit_number = 5
}
%>
<% if(page_type === 'post' && theme?.post?.word_count?.wordcount === true && temp_wordcount_count){ %>
<span class="meta-info-item article-wordcount">
<span class="meta-info-item post-wordcount">
<i class="icon fas fa-file-word"></i>&nbsp;<span><%= temp_wordcount_count %> <%- __('wordcount') %></span>
</span>
<% } %>
<% if(page_type === 'post' && theme?.post?.word_count?.min2read === true && temp_min2read_count){ %>
<span class="meta-info-item article-min2read">
<span class="meta-info-item post-min2read">
<i class="icon fas fa-clock"></i>&nbsp;<span><%= temp_min2read_count %> <%- __('min2read') %></span>
</span>
<% } %>
<% if (page_type === 'post' && theme?.website_count?.busuanzi_count?.enable === true && theme?.website_count?.busuanzi_count?.page_pv === true) { %>
<span class="meta-info-item article-pv">
<span class="meta-info-item post-pv">
<i class="icon fas fa-eye"></i>&nbsp;<span id="busuanzi_value_page_pv"></span>
</span>
<% } %>
Expand Down
14 changes: 7 additions & 7 deletions layout/home-content.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
<i class="icon right close fa-solid fa-close"></i>
</div>
<% } %>
<ul class="home-article-list border-box">
<ul class="home-post-list border-box">
<% page.posts.forEach(post => { %>
<li class="home-article-item">
<li class="home-post-item">
<% if (post?.home_cover) { %>
<div class="home-article-item-top border-box"
<div class="home-post-item-top border-box"
style="height: <%= post?.home_cover_height ? post?.home_cover_height + 'px' : '10rem' %>"
>
<% if (post.sticky) { %>
Expand All @@ -27,27 +27,27 @@
</div>
<% } %>
<div class="home-article-item-bottom border-box">
<div class="home-post-item-bottom border-box">
<% if (post.sticky && !post?.home_cover) { %>
<div class="post-sticky-box card">
<i class="fas fa-thumbtack"></i><span class="sticky-name">&nbsp;<%- __('top') %></span>
</div>
<% } %>
<h3 class="home-article-title border-box">
<h3 class="home-post-title border-box">
<a href="<%- url_for(post.path) %>">
<%= post.title %>
</a>
</h3>
<div class="home-article-content keep-markdown-body">
<div class="home-post-content keep-markdown-body">
<% if (post.excerpt) { %>
<%- post.excerpt %>
<% } else { %>
<%- truncate(strip_html(post.content), { length: 128 }) %>
<% } %>
</div>
<%- partial('_partial/article-meta-info', { post: post, page_type: 'home' }) %>
<%- partial('_partial/post/post-meta-info', { post: post, page_type: 'home' }) %>
</div>
</li>
<% }) %>
Expand Down
2 changes: 1 addition & 1 deletion layout/page.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<% } else if (is_post()) { %>
<%- partial('article-content') %>
<%- partial('post-content') %>
<% } else if (is_category()) { %>
Expand Down
40 changes: 19 additions & 21 deletions layout/article-content.ejs → layout/post-content.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ const post_avatar = page?.avatar || theme?.base_info?.avatar
%>
<div class="fade-in-down-animation">
<div class="post-page-container border-box">
<div class="article-content-container border-box">
<div class="post-content-container border-box">
<% if (page?.post_cover || page?.home_cover) { %>
<div class="article-content-top border-box"
<div class="post-content-top border-box"
style="height: <%= page?.post_cover_height ? page?.post_cover_height + 'px' : '13.8rem' %>"
>
<div class="cover-article-title">
<div class="cover-post-title">
<%= page.title %>
</div>
<img class="post-cover" src="<%- url_for(page.post_cover || page?.home_cover) %>"
Expand All @@ -18,43 +18,41 @@ const post_avatar = page?.avatar || theme?.base_info?.avatar
</div>
<% } %>
<div class="article-content-bottom border-box<%= (page?.post_cover || page?.home_cover) ? ' has-cover' : '' %>">
<div class="post-content-bottom border-box<%= (page?.post_cover || page?.home_cover) ? ' has-cover' : '' %>">
<% if (!page?.post_cover && !page?.home_cover) { %>
<div class="article-title">
<div class="post-title">
<%= page.title %>
</div>
<% } %>
<% if (post_author) { %>
<div class="article-header border-box">
<div class="post-header border-box">
<% if (post_avatar) { %>
<div class="avatar-box border-box">
<%- image_tag(post_avatar) %>
</div>
<% } %>
<div class="info-box">
<div class="author">
<div class="author border-box">
<span class="name"><%= post_author %></span>
<% if (theme?.post?.author_badge?.enable === true) { %>
<span class="author-badge"><%- getAuthorBadge(site.posts.length, theme?.post?.author_badge) %></span>
<% } %>
</div>
<div class="meta-info border-box">
<%- partial('_partial/article-meta-info', { post: page, page_type: 'post' }) %>
<%- partial('_partial/post/post-meta-info', { post: page, page_type: 'post' }) %>
</div>
</div>
</div>
<% } else { %>
<div class="article-header-meta-info">
<div class="meta-info border-box">
<%- partial('_partial/article-meta-info', { post: page, page_type: 'post' }) %>
</div>
<div class="post-header border-box">
<%- partial('_partial/post/post-meta-info', { post: page, page_type: 'post' }) %>
</div>
<% } %>
<div class="article-content keep-markdown-body">
<div class="post-content keep-markdown-body">
<% if (page?.aging === true) { %>
<div class="article-aging-tips"
<div class="post-aging-tips"
data-update-date="<%= page.updated %>"
data-aging-days="<%= page?.aging_days %>"
>
Expand Down Expand Up @@ -95,26 +93,26 @@ const post_avatar = page?.avatar || theme?.base_info?.avatar
<% } %>
<% if (page.prev || page.next) { %>
<div class="article-nav">
<div class="post-nav border-box">
<% if (page.prev) { %>
<div class="article-prev">
<div class="prev-post">
<a class="prev"
rel="prev"
href="<%- url_for(page.prev.path) %>"
title="<%= page.prev.title %>"
>
<span class="left arrow-icon flex-center">
<i class="fas fa-chevron-left"></i>
<i class="fas fa-chevron-left"></i>
</span>
<span class="title flex-center">
<span class="title flex-center">
<span class="post-nav-title-item text-ellipsis"><%= page.prev.title %></span>
<span class="post-nav-item"><%= __('prev_posts') %></span>
</span>
</a>
</div>
<% } %>
<% if (page.next) { %>
<div class="article-next">
<div class="next-post">
<a class="next"
rel="next"
href="<%- url_for(page.next.path) %>"
Expand All @@ -124,8 +122,8 @@ const post_avatar = page?.avatar || theme?.base_info?.avatar
<span class="post-nav-title-item text-ellipsis"><%= page.next.title %></span>
<span class="post-nav-item"><%= __('next_posts') %></span>
</span>
<span class="right arrow-icon flex-center">
<i class="fas fa-chevron-right"></i>
<span class="right arrow-icon flex-center">
<i class="fas fa-chevron-right"></i>
</span>
</a>
</div>
Expand Down
5 changes: 0 additions & 5 deletions source/css/common/keep-style.styl
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ root-color(mode) {
// h tag bottom border color
--post-h-bottom-border-color mode == 'light' ? $post-h-bottom-border-color : $dark-post-h-bottom-border-color

// article aging tips primary color
--article-aging-tips-color mode == 'light' ? $article-aging-tips-color : $dark-article-aging-tips-color
--article-aging-tips-background-color mode == 'light' ? $article-aging-tips-background-color : $dark-article-aging-tips-background-color
--article-aging-tips-border-color mode == 'light' ? $article-aging-tips-border-color : $dark-article-aging-tips-border-color

// keep info color
--keep-info-color mode == 'light' ? $keep-info-color : $dark-keep-info-color
--keep-info-background-color mode == 'light' ? $keep-info-background-color : $dark-keep-info-background-color
Expand Down
Loading

0 comments on commit 9cac987

Please sign in to comment.