diff --git a/themes/coo/layout/_partial/head.ejs b/themes/coo/layout/_partial/head.ejs index 813e25e..be1623d 100644 --- a/themes/coo/layout/_partial/head.ejs +++ b/themes/coo/layout/_partial/head.ejs @@ -1,7 +1,8 @@
- + '> + @@ -14,7 +15,7 @@ - + @@ -48,7 +49,7 @@ - + diff --git a/themes/coo/layout/layout.ejs b/themes/coo/layout/layout.ejs index 3f60c48..de3d64f 100644 --- a/themes/coo/layout/layout.ejs +++ b/themes/coo/layout/layout.ejs @@ -1,5 +1,5 @@ - + <%- partial('_partial/head') %> <%- partial('_partial/header') %> diff --git a/themes/coo/scripts/global.js b/themes/coo/scripts/global.js index b79dbaf..008846e 100644 --- a/themes/coo/scripts/global.js +++ b/themes/coo/scripts/global.js @@ -3,6 +3,21 @@ const path = require('path'); hexo.extend.helper.register('icon', (name) => svgIcon(name)); +// Register custom clean_url helper function +hexo.extend.helper.register('clean_url', function (url) { + if (!url) return ''; + // If it's an absolute URL, convert it to a relative URL first + const cleanedUrl = this.url_for(url); + // Remove .html suffix + return cleanedUrl.replace(/(index)?\.html$/, ''); +}); + +// Register enhanced url_for helper (optional) +hexo.extend.helper.register('url_for_clean', function (path, options = {}) { + const url = this.url_for(path, options); + return url.replace(/(index)?\.html$/, ''); +}); + hexo.extend.generator.register('json', (locals) => { const searchName = 'search.json'; const datas = locals.posts.sort('date') || []; diff --git a/themes/coo/scripts/seo.js b/themes/coo/scripts/seo.js index a97ddf6..f8b3ee5 100644 --- a/themes/coo/scripts/seo.js +++ b/themes/coo/scripts/seo.js @@ -49,7 +49,7 @@ hexo.extend.helper.register('page_keywords', function () { hexo.extend.helper.register('page_image', function () { const homePng = 'preview.png'; - let postPng = ''; + let postPng = 'preview.png'; if (this.is_post()) { postPng = `${this.page.slug}-preview.png`; }