From 63ceaf53521ecfb93923b2526c136b42927dd3b1 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Sat, 29 Oct 2022 17:23:32 +0800 Subject: [PATCH] timeline --- .github/ISSUE_TEMPLATE/any-question.md | 2 +- .github/ISSUE_TEMPLATE/article-share.md | 2 +- layout/_partial/head.ejs | 2 + layout/_partial/scripts/index.ejs | 1 + scripts/events/lib/config.js | 2 +- scripts/tags/friends.js | 3 - scripts/tags/timeline.js | 4 +- source/js/main.js | 2 +- source/js/plugins/timeline.js | 81 ++++++++++++++----------- 9 files changed, 56 insertions(+), 43 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/any-question.md b/.github/ISSUE_TEMPLATE/any-question.md index 8c0bc01..80b940b 100644 --- a/.github/ISSUE_TEMPLATE/any-question.md +++ b/.github/ISSUE_TEMPLATE/any-question.md @@ -1,5 +1,5 @@ --- -name: Any Question +name: Any Question【问题反馈】 about: 主题使用方面任何问题或建议 title: '' labels: '' diff --git a/.github/ISSUE_TEMPLATE/article-share.md b/.github/ISSUE_TEMPLATE/article-share.md index 7aadcd0..94d9150 100644 --- a/.github/ISSUE_TEMPLATE/article-share.md +++ b/.github/ISSUE_TEMPLATE/article-share.md @@ -1,5 +1,5 @@ --- -name: Article Share +name: Article Share【文章分享】 about: 与Stellar相关的文章分享 title: '[分享] ' labels: '教程' diff --git a/layout/_partial/head.ejs b/layout/_partial/head.ejs index 7a650f5..352fb35 100755 --- a/layout/_partial/head.ejs +++ b/layout/_partial/head.ejs @@ -45,6 +45,7 @@ function og_args() { %> <%- meta_generator() %> + <%- generate_robots() %> @@ -60,6 +61,7 @@ function og_args() { + <%- generate_title() %> <% if (theme.open_graph && theme.open_graph.enable) { %> diff --git a/layout/_partial/scripts/index.ejs b/layout/_partial/scripts/index.ejs index 7bf51ff..3dc91bb 100644 --- a/layout/_partial/scripts/index.ejs +++ b/layout/_partial/scripts/index.ejs @@ -90,6 +90,7 @@ } } }; + stellar.version = '<%- theme.stellar.version %>'; stellar.github = 'https://github.com/xaoxuu/hexo-theme-stellar/tree/<%- theme.stellar.version %>'; stellar.config = { date_suffix: { diff --git a/scripts/events/lib/config.js b/scripts/events/lib/config.js index d85f9d8..f7fcd13 100644 --- a/scripts/events/lib/config.js +++ b/scripts/events/lib/config.js @@ -25,7 +25,7 @@ module.exports = hexo => { warning('caching', '`relative_link` option in Hexo `_config.yml`'); hexo.config.relative_link = false; } - hexo.config.meta_generator = false; + // hexo.config.meta_generator = false; // merge data const data = hexo.locals.get('data'); diff --git a/scripts/tags/friends.js b/scripts/tags/friends.js index 095945b..1ce29b4 100644 --- a/scripts/tags/friends.js +++ b/scripts/tags/friends.js @@ -42,9 +42,6 @@ hexo.extend.tag.register('friends', function(args) { } el += '
'; const items = links[args.group] || []; - console.log('links', links); - console.log('group', args.group); - console.log('items', items); items.forEach((item, i) => { el += cell(item); }); diff --git a/scripts/tags/timeline.js b/scripts/tags/timeline.js index 58b7505..dccd70f 100644 --- a/scripts/tags/timeline.js +++ b/scripts/tags/timeline.js @@ -36,14 +36,14 @@ function layoutNodeContent(content) { function postTimeline(args, content) { - args = hexo.args.map(args, ['api', 'user', 'type', 'limit']); + args = hexo.args.map(args, ['api', 'user', 'type', 'limit', 'hide']); var el = ''; if (!args.type) { args.type = 'timeline'; } if (args.api && args.api.length > 0) { el += '
'); StellarTimeline.requestAPI(cfg.api, function(data) { $(el).find('.loading-wrap').remove(); + const query = new URL(cfg.api).search; const arr = data.content || data; var users = []; const filter = el.getAttribute('user'); if (filter && filter.length > 0) { users = filter.split(","); } + var hide = []; + const hideStr = el.getAttribute('hide'); + if (hideStr && hideStr.length > 0) { + hide = hideStr.split(","); + } arr.forEach((item, i) => { if (item.user && item.user.login && users.length > 0) { if (!users.includes(item.user.login)) { @@ -81,46 +87,53 @@ const StellarTimeline = { cell += '

' + date.toString().replace(/\sGMT([^.]*)/i, "") + '

'; cell += '
'; cell += '
'; - cell += '

'; - cell += ''; - cell += item.title || item.name || item.tag_name; - cell += ''; - cell += '

'; + if (!hide.includes('title')) { + cell += '

'; + cell += ''; + cell += item.title || item.name || item.tag_name; + cell += ''; + cell += '

'; + } cell += marked.parse(item.body); - cell += ''; cell += '
'; cell += ''; $(el).append(cell);