diff --git a/.coderabbit.yaml b/.coderabbit.yaml
index 43e301ef..e2c396d4 100644
--- a/.coderabbit.yaml
+++ b/.coderabbit.yaml
@@ -11,5 +11,10 @@ reviews:
auto_review:
enabled: true
drafts: false
+ path_filters:
+ - "!source/build/**"
+ - "*.min.js"
+ - "*.min.css"
+ - "*.map"
chat:
auto_reply: true
diff --git a/.github/workflows/build-and-commit.yml b/.github/workflows/build-and-commit.yml
new file mode 100644
index 00000000..e3d6584d
--- /dev/null
+++ b/.github/workflows/build-and-commit.yml
@@ -0,0 +1,51 @@
+name: Build JS and CSS
+
+on:
+ push:
+ branches:
+ - main
+ - dev
+ paths:
+ - 'source/js/**'
+ - 'source/css/**'
+ - 'source/build/**'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@v4
+ with:
+ persist-credentials: false # Prevent using GITHUB_TOKEN automatically
+ fetch-depth: 0 # Fetch all history for accurate file diffs
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: '20.x' # Specify your Node.js version
+
+ - name: Install Dependencies
+ run: npm install
+
+ - name: Build Project
+ run: npm run build
+
+ - name: Configure Git
+ run: |
+ git config user.name "github-actions"
+ git config user.email "github-actions@github.com"
+
+ - name: Commit and Push Changes
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ git add source/build/js source/build/css
+ # Check if there are any changes
+ if ! git diff --cached --quiet; then
+ git commit -m "ci: build and update source/build/js and source/build/css [skip ci]"
+ git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" HEAD:${GITHUB_REF#refs/heads/}
+ else
+ echo "No changes to commit"
+ fi
\ No newline at end of file
diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml
index e2404ded..87fd19b1 100644
--- a/.github/workflows/npm-publish.yml
+++ b/.github/workflows/npm-publish.yml
@@ -21,7 +21,7 @@ jobs:
- run: npm ci
- - run: npm run build:css
+ - run: npm run build
- run: npm publish
env:
diff --git a/.husky/pre-commit b/.husky/pre-commit
new file mode 100644
index 00000000..d6cb2884
--- /dev/null
+++ b/.husky/pre-commit
@@ -0,0 +1 @@
+npm run build
diff --git a/_config.yml b/_config.yml
index fa75966a..4ec4c337 100755
--- a/_config.yml
+++ b/_config.yml
@@ -317,6 +317,8 @@ articles:
default: cc_by_nc_sa # Default license, can be cc_by_nc_sa, cc_by_nd, cc_by_nc, cc_by_sa, cc_by, all_rights_reserved, public_domain
# Whether to enable lazyload for images
lazyload: true
+ # Pangu.js (automatically add space between Chinese and English). See https://github.com/vinta/pangu.js
+ pangu_js: false
# Article recommendation. Requires nodejieba (npm install nodejieba). Transplanted from hexo-theme-volantis.
recommendation:
# Whether to enable article recommendation
@@ -461,7 +463,7 @@ cdn:
# Whether to enable CDN
enable: false
# CDN Provider
- provider: npmmirror # npmmirror, zstatic, sustech, cdnjs, jsdelivr, unpkg, custom
+ provider: npmmirror # npmmirror, zstatic, cdnjs, jsdelivr, unpkg, custom
# Custom CDN URL
# format example: https://cdn.custom.com/hexo-theme-redefine/${version}/source/${path}
# The ${path} must leads to the root of the "source" folder of the theme
diff --git a/languages/fr.yml b/languages/fr.yml
new file mode 100644
index 00000000..0dbaad4b
--- /dev/null
+++ b/languages/fr.yml
@@ -0,0 +1,92 @@
+# ----------------------------------------
+# Traduction du site
+# ----------------------------------------
+search: recherche...
+toc: Sur cette page
+prev: Précédent
+next: Suivant
+prev_posts: Articles précédents
+next_posts: Articles suivants
+page: Page %d
+recent_posts: Articles récents
+share: Partager
+powered_by: "POWERED BY %s"
+theme: THEME
+rss_feed: Flux RSS
+category: Catégorie
+categories: Catégories
+tag: Tag
+tags: Tags
+post: Post
+posts: Posts
+tagcloud: Nuage de tags
+comment: Commentaire
+comments: Commentaires
+home: Accueil
+archive: Archive
+archives: Archives
+top: TOP
+sticky: Sticky
+go-back-home: Retour à l'accueil
+
+# ----------------------------------------
+# Traduction du menu
+# ----------------------------------------
+about: À propos
+changelog: Journal des modifications
+links: Liens
+link: Lien
+friends: Amis
+friend: Ami
+timeline: Chronologie
+shuoshuo: Shuoshuo
+
+# ----------------------------------------
+# Nombre de sites Web
+# ----------------------------------------
+site_uv: VISITEURS
+site_pv: NOMBRE TOTAL DE PAGES VUES
+read_more: Lire la suite
+wordcount: Mots
+min2read: Min
+status: Status
+
+# ----------------------------------------
+# Pied de page
+# ----------------------------------------
+runtime: Blog en ligne depuis
+days: Jours
+hours: Hrs
+minutes: Min
+seconds: Sec
+optimized_by: et Propulsé par Evan
+rights: Tous droits réservés
+site_posts: "%s posts au total"
+site_wordcount: "%s mots au total"
+
+# ----------------------------------------
+# Post
+# ----------------------------------------
+copyright:
+ author: Auteur
+ title: Titre
+ link: Lien
+ create_time: Créé à
+ update_time: Mis à jour à
+ license_title: Licence
+ license_content: "Cette œuvre est sous licence %s."
+ all_rights_reserved: "Tous droits réservés à © %s"
+ public_domain: "Cette œuvre est dans le domaine public."
+
+ago:
+ second: "Il y a %s secondes"
+ minute: "Il y a %s minutes"
+ hour: "Il y a %s heures"
+ day: "Il y a %s jours"
+ week: "Il y a %s semaines"
+ month: "Il y a %s mois"
+ year: "Il y a %s années"
+
+create_time: Créé
+update_time: Mis à jour
+expired: "Ce message a été écrit il y a %s jours et son contenu peut être obsolète."
\ No newline at end of file
diff --git a/layout/_partials/page-template.ejs b/layout/_partials/page-template.ejs
deleted file mode 100755
index 528d1d51..00000000
--- a/layout/_partials/page-template.ejs
+++ /dev/null
@@ -1,42 +0,0 @@
-
- <%
- const friendsTitle = ['friends', 'friend', '友情链接', '友情鏈接', '友情鏈結', '友情鏈結', '朋友', '朋友們', '朋友们', 'links','link', 'Link', 'Links'];
- const friendsTypes = ['links', 'link'];
- const isLoadFriendsLink = (
- theme.links
- && (friendsTypes.includes(page.type) || friendsTitle.includes(page.title))
- );
- const shuoshuoTitle = ['essays', 'essay', 'shuoshuo', '说说', '即刻短文', 'Shuoshuo'];
- const shuoshuoTypes = ['essays', 'essay', 'shuoshuo'];
- const isLoadShuoshuo = (
- (theme.essays || theme.shuoshuo)
- && (shuoshuoTypes.includes(page.type) || shuoshuoTitle.includes(page.title))
- );
- const masonryTitles = ['masonry', 'gallery', 'Masonry', 'Gallery', '照片墙', '照片牆', '相册', '相冊', '瀑布流', '瀑布流', 'photos', 'Photos', 'photo', 'Photo'];
- const masonryTypes = ['masonry', 'gallery', '瀑布流', '相册', 'photos', 'photo'];
- const isLoadMasonry = (
- (theme.masonry || theme.gallery || theme.photos)
- && (masonryTypes.includes(page.type) || masonryTitles.includes(page.title))
- )
- %>
-
- <% if (isLoadFriendsLink) { %>
- <%- partial('_widgets/friends-link') %>
- <% } else if (isLoadShuoshuo) { %>
- <%- partial('_widgets/essays') %>
- <% } else if (isLoadMasonry) { %>
- <%- partial('_widgets/masonry') %>
- <% } %>
-
- <% if (isLoadFriendsLink || page.content || isLoadShuoshuo || isLoadMasonry) { %>
- <%- page.content %>
- <% } else { %>
-
<%- page.title %>
- <% } %>
-
-
-
diff --git a/layout/_widgets/essays.ejs b/layout/_widgets/essays.ejs
deleted file mode 100644
index 1af66de1..00000000
--- a/layout/_widgets/essays.ejs
+++ /dev/null
@@ -1,23 +0,0 @@
-
\ No newline at end of file
diff --git a/layout/_widgets/friends-link.ejs b/layout/_widgets/friends-link.ejs
deleted file mode 100755
index 2cb1948a..00000000
--- a/layout/_widgets/friends-link.ejs
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
<%= page.title %>
- <% for (const category of theme.links) { %>
-
-
<%= category.links_category %>
-
- <% if (category.has_thumbnail == true) { %>
-
- <% } else { %>
-
- <% } %>
- <% } %>
-
-
diff --git a/layout/_widgets/local-search.ejs b/layout/_widgets/local-search.ejs
deleted file mode 100755
index 97b4bc2c..00000000
--- a/layout/_widgets/local-search.ejs
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
diff --git a/layout/_widgets/masonry.ejs b/layout/_widgets/masonry.ejs
deleted file mode 100644
index 9c24be83..00000000
--- a/layout/_widgets/masonry.ejs
+++ /dev/null
@@ -1,27 +0,0 @@
-<%
-// Define an array of images to display in the masonry layout
-const images = theme.masonry;
-%>
-
-
-
-
-
-
- <% images.forEach(function(image) { %>
-
-
-
-
<%- image.title %>
-
<%- image.description %>
-
-
- <% }); %>
-
-
diff --git a/layout/_widgets/paginator.ejs b/layout/_widgets/paginator.ejs
deleted file mode 100755
index c4bf513d..00000000
--- a/layout/_widgets/paginator.ejs
+++ /dev/null
@@ -1,7 +0,0 @@
-
- <%- paginator({
- prev_text: '',
- next_text: '',
- escape: false
- }) %>
-
diff --git a/layout/_widgets/post-tools.ejs b/layout/_widgets/post-tools.ejs
deleted file mode 100755
index b649c8cb..00000000
--- a/layout/_widgets/post-tools.ejs
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
- <% if (theme.articles.toc.enable) { %>
- -
-
-
- <% } %>
-
-
- <% if (theme.comment.enable === true && theme.comment.hasOwnProperty('system') && page.comment !== false) { %>
-
- <% } %>
-
-
diff --git a/layout/_widgets/progress-bar.ejs b/layout/_widgets/progress-bar.ejs
deleted file mode 100755
index 1cc558e5..00000000
--- a/layout/_widgets/progress-bar.ejs
+++ /dev/null
@@ -1,13 +0,0 @@
-
- <% if (theme.global.scroll_progress.bar === true) { %>
-
- <% } %>
-
- <% if (theme.global.single_page === true) { %>
-
-
-
-
- <% } %>
-
-
diff --git a/layout/_widgets/side-tools.ejs b/layout/_widgets/side-tools.ejs
deleted file mode 100755
index c90ccfc7..00000000
--- a/layout/_widgets/side-tools.ejs
+++ /dev/null
@@ -1,54 +0,0 @@
-
diff --git a/layout/article-content.ejs b/layout/article-content.ejs
deleted file mode 100755
index 0a697c6f..00000000
--- a/layout/article-content.ejs
+++ /dev/null
@@ -1,160 +0,0 @@
-
-
-
-
- <% if (page.cover || page.banner || (page.thumbnail && page.thumbnail !== false)) { %>
- <% let articleCover = "";
- if (page.cover && page.cover.includes("/")) {
- articleCover = page.cover;
- } else if (page.banner && page.banner.includes("/")) {
- articleCover = page.banner;
- } else if (page.thumbnail && page.thumbnail !== null) {
- articleCover = page.thumbnail;
- } else if (config.marked.postAsset && config.marked.postAsset == true) {
- articleCover = [page.path, page.cover || page.banner].join("/");
- }
- %>
- <% if (articleCover) { %>
-
- <% } %>
-
">
-
<%= page.title %>
-
- <% } else { %>
-
">
-
<%= page.title %>
-
- <% } %>
-
-
- <% if (theme.info.author || config.author) { %>
-
-
- <%- image_tag((typeof page.avatar === "string" && (page.avatar)) || page.author?.avatar || theme.defaults.avatar) %>
-
-
-
- <%= (typeof page.author === "string" && (page.author)) || page.author?.name || theme.info.author || config.author %>
- <% if (theme.hasOwnProperty('articles') && theme.articles.author_label.enable === true) { %>
- <%- getAuthorLabel(site.posts.length, theme.articles.author_label.auto, theme.articles.author_label.list) %>
- <% } %>
-
-
- <%- partial('_meta/article-info', {articleObject: page, index: true}) %>
-
-
-
- <% } else { %>
-
-
- <%- partial('_meta/article-info', {articleObject: page, index: true}) %>
-
-
- <% } %>
-
- <% if (page.expires && page.expires !== "") {%>
-
-
- <%= __('expired', "some") %>
-
-
-
- <% } %>
-
-
-
- <%- page.content %>
-
-
- <% if (theme.articles.copyright.enable || theme.articles.copyright === true) { %>
-
- <%- partial('_meta/article-copyright') %>
-
- <% } %>
-
- <% if (page.tags.length) { %>
-
- <% } %>
-
- <%- articleRecommendationGenerator(page) %>
-
- <% if (page.prev || page.next) { %>
-
- <% if (page.prev) { %>
-
- <% } %>
- <% if (page.next) { %>
-
- <% } %>
-
- <% } %>
-
-
- <% if (theme.comment.enable === true && theme.comment.hasOwnProperty('system') && page.comment !== false) { %>
-
- <% } %>
-
-
- <% if (is_post() && theme.articles.toc.enable === true) { %>
-
- <%- partial('_widgets/toc') %>
-
- <% } %>
-
-
diff --git a/layout/category-content.ejs b/layout/category-content.ejs
deleted file mode 100755
index d7fb95cf..00000000
--- a/layout/category-content.ejs
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
- <%= page.category %>
-
-
- <%- partial('_widgets/archive-list', {posts_new: page.posts}) %>
-
-
-
- <%- partial('_widgets/paginator', {pageObject: page}) %>
-
-
diff --git a/layout/category-list.ejs b/layout/category-list.ejs
deleted file mode 100755
index b5620fad..00000000
--- a/layout/category-list.ejs
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
- <%- list_categories(site.categories, { class: 'all-category', depth: 5,
- style: 'list', }) %>
-
-
-
diff --git a/layout/_partials/comments/comment.ejs b/layout/components/comments/comment.ejs
similarity index 73%
rename from layout/_partials/comments/comment.ejs
rename to layout/components/comments/comment.ejs
index 4c53bd55..5e2efd21 100755
--- a/layout/_partials/comments/comment.ejs
+++ b/layout/components/comments/comment.ejs
@@ -6,16 +6,16 @@
<% if (theme.comment.enable === true && theme.comment.hasOwnProperty('system')) { %>
<% if (theme.comment.system === 'waline') { %>
- <%- partial('waline') %>
+ <%- partial('components/comments/waline') %>
<% } else if (theme.comment.system === 'gitalk') { %>
- <%- partial('gitalk') %>
+ <%- partial('components/comments/gitalk') %>
<% } else if (theme.comment.system === 'twikoo') { %>
- <%- partial('twikoo') %>
+ <%- partial('components/comments/twikoo') %>
<% } else if (theme.comment.system === 'giscus') { %>
- <%- partial('giscus') %>
+ <%- partial('components/comments/giscus') %>
<% } %>
<% } %>
diff --git a/layout/_partials/comments/giscus.ejs b/layout/components/comments/giscus.ejs
similarity index 100%
rename from layout/_partials/comments/giscus.ejs
rename to layout/components/comments/giscus.ejs
diff --git a/layout/_partials/comments/gitalk.ejs b/layout/components/comments/gitalk.ejs
similarity index 100%
rename from layout/_partials/comments/gitalk.ejs
rename to layout/components/comments/gitalk.ejs
diff --git a/layout/_partials/comments/twikoo.ejs b/layout/components/comments/twikoo.ejs
similarity index 100%
rename from layout/_partials/comments/twikoo.ejs
rename to layout/components/comments/twikoo.ejs
diff --git a/layout/_partials/comments/waline.ejs b/layout/components/comments/waline.ejs
similarity index 100%
rename from layout/_partials/comments/waline.ejs
rename to layout/components/comments/waline.ejs
diff --git a/layout/_partials/footer.ejs b/layout/components/footer/footer.ejs
similarity index 100%
rename from layout/_partials/footer.ejs
rename to layout/components/footer/footer.ejs
diff --git a/layout/_partials/head.ejs b/layout/components/header/head.ejs
similarity index 96%
rename from layout/_partials/head.ejs
rename to layout/components/header/head.ejs
index 12e2d0b0..47795d0f 100755
--- a/layout/_partials/head.ejs
+++ b/layout/components/header/head.ejs
@@ -17,7 +17,6 @@
'unpkg': 'https://unpkg.com',
'aliyun': 'https://evan.beee.top',
'cdnjs': 'https://cdnjs.cloudflare.com',
- 'sustech': 'https://mirrors.sustech.edu.cn',
'zstatic': 'https://s4.zstatic.net',
'npmmirror': 'https://registry.npmmirror.com',
@@ -27,7 +26,7 @@
<% } %>
<% } %>
- <%- generate_seo(theme, page) %>
+ <%- generateMeta(theme, page) %>
<%- autoCanonical(config, page) %>
@@ -93,9 +92,9 @@
<%- css('css/style') %>
<% if (theme.developer && theme.developer.enable) {%>
- <%- css('assets/build/styles.css') %>
+ <%- css('build/css/tailwind.css') %>
<% } else {%>
- <%- renderCSS('assets/build/styles.css') %>
+ <%- renderCSS('build/css/tailwind.css') %>
<% } %>
<%- renderCSS('fonts/GeistMono/geist-mono.css') %>
diff --git a/layout/_partials/navbar.ejs b/layout/components/header/navbar.ejs
similarity index 96%
rename from layout/_partials/navbar.ejs
rename to layout/components/header/navbar.ejs
index 11972b5a..f9fc4d83 100755
--- a/layout/_partials/navbar.ejs
+++ b/layout/components/header/navbar.ejs
@@ -25,7 +25,7 @@
<%
let link = theme.navbar.links[i];
let hasSubmenus = link.submenus;
- let isActive = isInHomePaging(page.path, link.path) || is_current(link.path);
+ let isActive = isHomePagePagination(page.path, link.path) || is_current(link.path);
let linkHref = hasSubmenus ? '#' : url_for(link.path);
let onClickAction = hasSubmenus ? 'onClick="return false;"' : '';
let iconClass = link.icon ? `` : '';
@@ -85,7 +85,7 @@
<%
// Function to check if link is active
function isActiveLink(pagePath, linkPath) {
- return isInHomePaging(pagePath, linkPath) || is_current(linkPath);
+ return isHomePagePagination(pagePath, linkPath) || is_current(linkPath);
}
// Variables for cleaner code
@@ -154,7 +154,7 @@
<% } %>
- <%- partial("sidebar-components/statistics") %>
+ <%- partial("components/sidebar/statistics") %>
diff --git a/layout/_partials/preloader.ejs b/layout/components/header/preloader.ejs
similarity index 100%
rename from layout/_partials/preloader.ejs
rename to layout/components/header/preloader.ejs
diff --git a/layout/components/header/progress-bar.ejs b/layout/components/header/progress-bar.ejs
new file mode 100755
index 00000000..918aebed
--- /dev/null
+++ b/layout/components/header/progress-bar.ejs
@@ -0,0 +1,12 @@
+
+ <% if (theme.global.scroll_progress.bar === true) { %>
+
+ <% } %>
+
+ <% if (theme.global.single_page === true) { %>
+
+
+
+
+ <% } %>
+
\ No newline at end of file
diff --git a/layout/_plugins/aplayer.ejs b/layout/components/plugins/aplayer.ejs
similarity index 100%
rename from layout/_plugins/aplayer.ejs
rename to layout/components/plugins/aplayer.ejs
diff --git a/layout/_partials/scripts.ejs b/layout/components/scripts.ejs
similarity index 86%
rename from layout/_partials/scripts.ejs
rename to layout/components/scripts.ejs
index 5797c2c0..978ebea8 100755
--- a/layout/_partials/scripts.ejs
+++ b/layout/components/scripts.ejs
@@ -72,3 +72,15 @@
<%- renderJS('js/libs/moment-with-locales.min.js', { swupReload: true }) %>
<%- renderJS('js/layouts/essays.js', { swupReload: true, module: true }) %>
+<% if (theme.articles.pangu_js) { %>
+ <%- renderJS([
+ 'js/libs/pangu.min.js',
+ 'js/plugins/pangu.js'
+ ]) %>
+<% } %>
+
+<% if (theme.bookmarks && theme.bookmarks.length !== 0) { %>
+ <%- renderJS('js/layouts/bookmarkNav.js', {
+ module: true
+ }) %>
+<% } %>
\ No newline at end of file
diff --git a/layout/_partials/sidebar-components/author.ejs b/layout/components/sidebar/author.ejs
similarity index 100%
rename from layout/_partials/sidebar-components/author.ejs
rename to layout/components/sidebar/author.ejs
diff --git a/layout/_partials/sidebar-components/avatar.ejs b/layout/components/sidebar/avatar.ejs
similarity index 100%
rename from layout/_partials/sidebar-components/avatar.ejs
rename to layout/components/sidebar/avatar.ejs
diff --git a/layout/_partials/sidebar-components/statistics.ejs b/layout/components/sidebar/statistics.ejs
similarity index 100%
rename from layout/_partials/sidebar-components/statistics.ejs
rename to layout/components/sidebar/statistics.ejs
diff --git a/layout/_plugins/swup.ejs b/layout/components/swup.ejs
similarity index 100%
rename from layout/_plugins/swup.ejs
rename to layout/components/swup.ejs
diff --git a/layout/layout.ejs b/layout/layout.ejs
index 13264e41..0c76d6c2 100755
--- a/layout/layout.ejs
+++ b/layout/layout.ejs
@@ -1,11 +1,13 @@
-<%- partial('_partials/head') %>
+<%- partial('components/header/head') %>
+
-<%- body %>
-<%- partial('_partials/scripts') %>
-<% if (theme.plugins.aplayer.enable) { %>
- <%- partial('_plugins/aplayer') %>
-<% } %>
+ <%- body %>
+ <%- partial('components/scripts') %>
+ <% if (theme.plugins.aplayer.enable) { %>
+ <%- partial('components/plugins/aplayer') %>
+ <% } %>
-
+
+