update
This commit is contained in:
parent
91f695daf0
commit
2468337f69
43
_config.yml
43
_config.yml
|
@ -9,31 +9,30 @@ stellar:
|
|||
|
||||
|
||||
######## head tags ########
|
||||
head:
|
||||
open_graph: true
|
||||
twitter: false
|
||||
open_graph:
|
||||
enable: true
|
||||
twitter_id: # for open_graph meta
|
||||
|
||||
|
||||
######## Sidebar ########
|
||||
sidebar:
|
||||
logo:
|
||||
avatar: # default is config.avatar
|
||||
title: # default is config.title
|
||||
logo_action:
|
||||
avatar: /about/
|
||||
title: /
|
||||
avatar:
|
||||
src: # default is config.avatar
|
||||
href: # set your user center page like: '/about/'
|
||||
title: # default is config.title, you can set html tag like: '<img no-lazy height="32px" src="xxx"/>'
|
||||
menu:
|
||||
- class: post # post, wiki, about
|
||||
name: btn.blog
|
||||
post:
|
||||
title: btn.blog
|
||||
url: /
|
||||
- class: wiki
|
||||
name: btn.wiki
|
||||
wiki:
|
||||
title: btn.wiki
|
||||
url: /wiki/
|
||||
- class: friends
|
||||
name: 友链
|
||||
friends:
|
||||
title: 友链
|
||||
url: /friends/
|
||||
- class: about
|
||||
name: 关于
|
||||
about:
|
||||
title: 关于
|
||||
url: /about/
|
||||
# Sidebar widgets
|
||||
widgets:
|
||||
|
@ -65,7 +64,7 @@ article:
|
|||
# npm i hexo-related-popular-posts
|
||||
related_posts:
|
||||
enable: false
|
||||
title: 您可能感兴趣的文章
|
||||
title: meta.related_posts
|
||||
max_count: 5
|
||||
placeholder_img: https://7.dusays.com/2021/02/20/76b86c0226ffd.svg
|
||||
# 分享文章
|
||||
|
@ -104,10 +103,8 @@ footer:
|
|||
url: https://music.163.com/#/user/home?id=63035382
|
||||
- icon: '<img src="https://7.dusays.com/2021/02/14/942ebbf1a4b91.svg"/>'
|
||||
url: /comments/
|
||||
license: 'CC BY SA 4.0'
|
||||
source:
|
||||
where: GitHub
|
||||
url: https://github.com/xaoxuu/site-source
|
||||
license: '[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)'
|
||||
source: #'[GitHub](https://github.com/xaoxuu/hexo-theme-stellar)'
|
||||
|
||||
|
||||
######## Tag Plugins ########
|
||||
|
@ -141,8 +138,8 @@ plugins:
|
|||
## optional plugins ##
|
||||
# preload
|
||||
preload:
|
||||
enable: #true
|
||||
service: instant_page # instant_page, flying_pages
|
||||
enable: true
|
||||
service: flying_pages # instant_page, flying_pages
|
||||
instant_page: https://cdn.jsdelivr.net/gh/volantis-x/cdn-volantis@4.1.2/js/instant_page.js
|
||||
flying_pages: https://cdn.jsdelivr.net/gh/gijo-varghese/flying-pages@2.1.2/flying-pages.min.js
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ btn:
|
|||
tag: Tag
|
||||
tags: Tags
|
||||
archives: Archives
|
||||
learn_more: Learn more
|
||||
getting_started: Getting Started
|
||||
|
||||
meta:
|
||||
|
@ -19,19 +18,20 @@ meta:
|
|||
read_next: READ NEXT
|
||||
older: Older
|
||||
references: References
|
||||
related_posts: Related Posts
|
||||
comment_title: Join the discussion
|
||||
back_to_top: Back to top
|
||||
more: 'More %s'
|
||||
|
||||
footer:
|
||||
license: 'Unless otherwise specified, this site adopts the CC BY SA 4.0 license agreement.'
|
||||
info_not_open_source: 'This site was created by %s, using [Stellar](https://github.com/xaoxuu/hexo-theme-stellar) as the theme.'
|
||||
info_open_source: 'This site was created by %s, using [Stellar](https://github.com/xaoxuu/hexo-theme-stellar) as the theme. You can find the source code of this site in [%s](%s).'
|
||||
license: 'All articles in this blog are licensed under %s unless stating additionally.'
|
||||
info_not_open_source: 'This site was deployed by %s using %s.'
|
||||
info_open_source: 'This site was deployed by %s using %s. You can find the source code in %s.'
|
||||
|
||||
page:
|
||||
error:
|
||||
what: Page Not Found
|
||||
why: The address may be entered incorrectly or the address has been deleted
|
||||
why: The address may be entered incorrectly or the address has been deleted.
|
||||
action: Back to Home
|
||||
categories: '%s Categories'
|
||||
tags: '%s Tags'
|
||||
|
|
|
@ -9,7 +9,6 @@ btn:
|
|||
tag: 标签
|
||||
tags: 标签
|
||||
archives: 归档
|
||||
learn_more: 了解详情
|
||||
getting_started: 开始使用
|
||||
|
||||
meta:
|
||||
|
@ -19,12 +18,13 @@ meta:
|
|||
read_next: 接下来阅读
|
||||
older: 更早一篇
|
||||
references: 参考资料
|
||||
related_posts: 您可能感兴趣的文章
|
||||
comment_title: 快来参与讨论吧
|
||||
back_to_top: 回到顶部
|
||||
more: '更多%s'
|
||||
|
||||
footer:
|
||||
license: '除非特别说明,本站采用 CC BY SA 4.0 许可协议。'
|
||||
license: '本博客所有文章除特别声明外,均采用 %s 许可协议。转载请注明出处!'
|
||||
info_not_open_source: '本站由 %s 创建,使用 [Stellar](https://github.com/xaoxuu/hexo-theme-stellar) 作为主题。'
|
||||
info_open_source: '本站由 %s 创建,使用 [Stellar](https://github.com/xaoxuu/hexo-theme-stellar) 作为主题,您可以在 [%s](%s) 找到本站源码。'
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ btn:
|
|||
tag: 標籤
|
||||
tags: 標籤
|
||||
archives: 歸檔
|
||||
learn_more: 了解詳情
|
||||
getting_started: 開始使用
|
||||
|
||||
meta:
|
||||
|
@ -19,12 +18,13 @@ meta:
|
|||
read_next: 接下來閱讀
|
||||
older: 更早一篇
|
||||
references: 參考資料
|
||||
related_posts: 您可能感興趣的文章
|
||||
comment_title: 快來參與討論吧
|
||||
back_to_top: 回到頂部
|
||||
more: '更多%s'
|
||||
|
||||
footer:
|
||||
license: '除非特別說明,本站採用 CC BY SA 4.0 許可協議。'
|
||||
license: '本網誌所有文章除特別聲明外,均採用 %s 許可協議。轉載請註明出處!'
|
||||
info_not_open_source: '本站由 %s 創建,使用 [Stellar](https://github.com/xaoxuu/hexo-theme-stellar) 作為主題。'
|
||||
info_open_source: '本站由 %s 創建,使用 [Stellar](https://github.com/xaoxuu/hexo-theme-stellar) 作為主題,您可以在 [%s](%s) 找到本站源碼。'
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<%
|
||||
page.class = '404';
|
||||
page.menu_id = '404';
|
||||
page.layout = '404';
|
||||
page.comment_title = '';
|
||||
page.header = false;
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
<%
|
||||
function layoutDiv() {
|
||||
var wrapper = '';
|
||||
wrapper += '<div><hr>';
|
||||
if (theme.footer.license) {
|
||||
wrapper += markdown(__('footer.license', theme.footer.license));
|
||||
}
|
||||
const author = '[' + config.author + '](' + config.url + config.root + ')';
|
||||
if (theme.footer.source && theme.footer.source.where && theme.footer.source.url) {
|
||||
wrapper += markdown(__('footer.info_open_source', author, theme.footer.source.where, theme.footer.source.url));
|
||||
} else {
|
||||
wrapper += markdown(__('footer.info_not_open_source', author));
|
||||
}
|
||||
wrapper += '</div>';
|
||||
return wrapper;
|
||||
}
|
||||
%>
|
||||
<%- layoutDiv() %>
|
|
@ -1,16 +1,4 @@
|
|||
<%
|
||||
function genrateRobots() {
|
||||
var el = '';
|
||||
if (page.robots) {
|
||||
el += '<meta name="robots" content="' + page.robots + '">';
|
||||
} else if (is_home() == false) {
|
||||
if (['post', 'wiki', 'index'].includes(page.layout) == false) {
|
||||
el += '<meta name="robots" content="noindex,nofollow">';
|
||||
}
|
||||
}
|
||||
return el;
|
||||
}
|
||||
|
||||
function getTitle() {
|
||||
if (page.seo_title || page.title || page.wiki || page.layout) {
|
||||
return (page.seo_title || page.title || page.wiki || page.layout) + ' - ' + config.title;
|
||||
|
@ -23,78 +11,25 @@ function getTitle() {
|
|||
}
|
||||
return '';
|
||||
}
|
||||
function getKeywords() {
|
||||
if (page.keywords) {
|
||||
return page.keywords;
|
||||
} else if (page.tags && page.tags.length > 0) {
|
||||
return page.tags.map(function(t){return t.name}).join(',');
|
||||
}
|
||||
return '';
|
||||
if (page.description == undefined) {
|
||||
page.description = stellar_meta('description', page);
|
||||
}
|
||||
function getDescription() {
|
||||
if (page.description) {
|
||||
return page.description;
|
||||
} else {
|
||||
if (['post', 'wiki'].includes(page.layout)) {
|
||||
if (page.excerpt && page.excerpt.length > 0) {
|
||||
return strip_html(page.excerpt);
|
||||
} else if (page.content && page.content.length > 0) {
|
||||
return truncate(strip_html(page.content), {length: 160});
|
||||
function og_args() {
|
||||
var args = {};
|
||||
if (theme.open_graph.twitter_id) {
|
||||
args.twitter_id = theme.open_graph.twitter_id;
|
||||
}
|
||||
if (page.layout == 'post' && page.cover) {
|
||||
args.twitter_card = 'summary_large_image';
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
function genrateKeywords() {
|
||||
const keywords = getKeywords();
|
||||
if (keywords && keywords.length > 0) {
|
||||
return '<meta name="keywords" content="' + keywords + '">';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
function genrateDescription() {
|
||||
const description = getDescription();
|
||||
if (description && description.length > 0) {
|
||||
return '<meta name="description" content="' + description + '">';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
function genrateOpenGraph() {
|
||||
if (theme.head.open_graph == false) {
|
||||
return '';
|
||||
}
|
||||
var el = '';
|
||||
el += '<meta property="og:title" content="' + getTitle() + '">';
|
||||
el += '<meta property="og:description" content="' + getDescription() + '">';
|
||||
el += '<meta property="og:locale" content="' + page.lang.replace('-', '_') + '">';
|
||||
el += '<meta property="og:url" content="' + page.permalink + '">';
|
||||
el += '<meta property="og:type" content="website">';
|
||||
el += '<meta property="og:site_name" content="' + config.title + '">';
|
||||
if (page.layout == 'post' && page.cover && page.cover.length > 0) {
|
||||
el += '<meta property="og:image" content="' + page.cover + '">';
|
||||
}
|
||||
return el;
|
||||
}
|
||||
function genrateTwitter() {
|
||||
if (theme.head.twitter == undefined || theme.head.twitter.length == 0 || theme.head.twitter == false) {
|
||||
return '';
|
||||
}
|
||||
var el = '';
|
||||
if (theme.head.twitter != 'true') {
|
||||
el += '<meta property="twitter:site" content="@' + theme.head.twitter + '">';
|
||||
}
|
||||
if (page.layout == 'post' && page.cover && page.cover.length > 0) {
|
||||
el += '<meta name="twitter:image" content="' + page.cover + '">';
|
||||
el += '<meta name="twitter:card" content="summary_large_image">';
|
||||
}
|
||||
return el;
|
||||
return args;
|
||||
}
|
||||
%>
|
||||
<head hexo-theme='https://github.com/xaoxuu/hexo-theme-stellar/tree/<%- theme.stellar.version %>'>
|
||||
<head hexo-theme='<%- stellar_info("tree") %>'>
|
||||
<%- meta_generator() %>
|
||||
<meta charset="utf-8">
|
||||
<%- genrateRobots() %>
|
||||
<meta name='robots' content='<%- stellar_meta("robots", page) %>'>
|
||||
|
||||
<meta http-equiv='x-dns-prefetch-control' content='on' />
|
||||
<link rel='dns-prefetch' href='https://cdn.jsdelivr.net'>
|
||||
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
|
||||
|
@ -107,11 +42,10 @@ function genrateTwitter() {
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
|
||||
<title><%- getTitle() %></title>
|
||||
<%- genrateKeywords() %>
|
||||
<%- genrateDescription() %>
|
||||
<%- genrateOpenGraph() %>
|
||||
<%- genrateTwitter() %>
|
||||
|
||||
<% if (theme.open_graph && theme.open_graph.enable) { %>
|
||||
<%- open_graph(og_args()) %>
|
||||
<% } %>
|
||||
|
||||
<!-- feed -->
|
||||
<% if (config.feed && config.feed.path) { %>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<% let post = page; %>
|
||||
<div class='related-posts-wrap'><%-
|
||||
popular_posts_wrapper(
|
||||
popular_posts_json({ maxCount: 5 , ulClass: 'related-posts' , PPMixingRate: 0.2 , isImage: true , isExcerpt: true} , post )
|
||||
) %></div>
|
||||
popular_posts_wrapper({
|
||||
title: __('meta.related_posts'),
|
||||
json: popular_posts_json({ maxCount: 5 , ulClass: 'related-posts' , PPMixingRate: 0.2 , isImage: true , isExcerpt: true} , post )
|
||||
}) %></div>
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<%
|
||||
const author = '[' + config.author + '](' + config.url + config.root + ')';
|
||||
const using = '[' + stellar_info('name') + '](' + stellar_info('tree') + ')';
|
||||
const source = theme.footer.source;
|
||||
function layoutDiv() {
|
||||
var wrapper = '';
|
||||
wrapper += '<div><hr>';
|
||||
if (theme.footer.license) {
|
||||
wrapper += markdown(__('footer.license', theme.footer.license));
|
||||
}
|
||||
if (source) {
|
||||
wrapper += markdown(__('footer.info_open_source', author, using, source));
|
||||
} else {
|
||||
wrapper += markdown(__('footer.info_not_open_source', author, using));
|
||||
}
|
||||
wrapper += '</div>';
|
||||
return wrapper;
|
||||
}
|
||||
%>
|
||||
<%- layoutDiv() %>
|
|
@ -30,7 +30,7 @@
|
|||
<a class='cap breadcrumb' href='<%- url_for(p.path) %>'><%- p.title %></a>
|
||||
<% }); %>
|
||||
<% site.pages.filter(function (p) { %>
|
||||
<% return p.layout == 'wiki' && p.wiki == page.wiki && !p.order %>
|
||||
<% return p.layout == 'wiki' && p.wiki == page.wiki && p.description %>
|
||||
<% }).limit(1).each(function(p) { %>
|
||||
<span class="sep"></span>
|
||||
<a class='cap breadcrumb' href='<%- url_for(p.path) %>'><%- page.wiki %></a>
|
||||
|
|
|
@ -35,7 +35,4 @@
|
|||
<% } else if (post.excerpt) { %>
|
||||
<%- strip_html(post.excerpt) %>
|
||||
<% } %>
|
||||
<div class='readmore cap'>
|
||||
了解详情
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,16 +1,22 @@
|
|||
<%
|
||||
function layoutMainMenu() {
|
||||
var el = '';
|
||||
el += '<nav class="menu">'
|
||||
for (let id of Object.keys(theme.sidebar.menu)) {
|
||||
let item = theme.sidebar.menu[id];
|
||||
el += '<a class="nav-item';
|
||||
if (id == page.menu_id) {
|
||||
el += ' active';
|
||||
}
|
||||
el += '" href="' + url_for(item.url) + '">';
|
||||
el += '<span>' + __(item.title) + '</span>';
|
||||
el += '</a>';
|
||||
}
|
||||
el += '</nav>';
|
||||
return el;
|
||||
}
|
||||
%>
|
||||
<header class='header'>
|
||||
<%- partial('logo') %>
|
||||
<nav class='menu'>
|
||||
<% theme.sidebar.menu.forEach((item, i) => { %>
|
||||
<% if (item.class == page.class) { %>
|
||||
<a class='nav-item active' href='<%- url_for(item.url) %>'>
|
||||
<span><%- __(item.name) %></span>
|
||||
</a>
|
||||
<% } else { %>
|
||||
<a class='nav-item' href='<%- url_for(item.url) %>'>
|
||||
<span><%- __(item.name) %></span>
|
||||
</a>
|
||||
<% } %>
|
||||
<% }); %>
|
||||
</nav>
|
||||
<%- layoutMainMenu() %>
|
||||
</header>
|
|
@ -1,8 +1,6 @@
|
|||
<div class='logo-wrap'>
|
||||
<a href='/'>
|
||||
<% if (theme.sidebar.logo.avatar != false) { %>
|
||||
<div class='img'><img no-lazy src='<%- theme.sidebar.logo.avatar || config.avatar %>'/></div>
|
||||
<% if (theme.sidebar.logo.avatar.src || config.avatar) { %>
|
||||
<a class='img' href='<%- theme.sidebar.logo.avatar.href || "/" %>'><img no-lazy src='<%- theme.sidebar.logo.avatar.src || config.avatar %>'/></a>
|
||||
<% } %>
|
||||
<span class='title'><%- theme.sidebar.logo.title || config.title %></span>
|
||||
</a>
|
||||
<a class='title' href='/'><%- theme.sidebar.logo.title || config.title %></a>
|
||||
</div>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</div>
|
||||
<div class='widget-body'>
|
||||
<%
|
||||
var arr = page.class == 'wiki' ? site.pages.filter(function(p){
|
||||
var arr = page.menu_id == 'wiki' ? site.pages.filter(function(p){
|
||||
return p.layout == 'wiki' && p.title && p.title.length > 0;
|
||||
}) : site.posts.filter(function(p){
|
||||
return p.title && p.title.length > 0;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<%
|
||||
if (page.class == undefined) {
|
||||
page.class = 'post';
|
||||
if (page.menu_id == undefined) {
|
||||
page.menu_id = 'post';
|
||||
}
|
||||
%>
|
||||
<% if (page.posts && (is_category() || is_tag())) { %>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<%
|
||||
if (page.class == undefined) {
|
||||
page.class = 'post';
|
||||
if (page.menu_id == undefined) {
|
||||
page.menu_id = 'post';
|
||||
}
|
||||
%>
|
||||
<% if (site.categories.length) { %>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<%
|
||||
if (page.class == undefined) {
|
||||
if (page.menu_id == undefined) {
|
||||
if (page.layout == 'index' && page.title && page.wiki) {
|
||||
page.class = 'wiki';
|
||||
page.menu_id = 'wiki';
|
||||
} else {
|
||||
page.class = 'post';
|
||||
page.menu_id = 'post';
|
||||
}
|
||||
}
|
||||
%>
|
||||
<% if (page.class == 'post') { %>
|
||||
<% if (page.menu_id == 'post') { %>
|
||||
<%- partial('_partial/main/navbar/list_post') %>
|
||||
<% if (page.posts) { %>
|
||||
<div class='post-list post'>
|
||||
|
@ -21,7 +21,7 @@ if (page.class == undefined) {
|
|||
<%- partial('_partial/main/post_list/paginator') %>
|
||||
</div>
|
||||
<% } %>
|
||||
<% } else if (page.class == 'wiki') { %>
|
||||
<% } else if (page.menu_id == 'wiki') { %>
|
||||
<% function outputExcerpt(post) { %>
|
||||
<a class='post-card wiki reveal' href='<%- url_for(post.link || post.path) %>'>
|
||||
<article class='excerpt md'>
|
||||
|
|
|
@ -11,11 +11,13 @@
|
|||
<%- partial('_partial/main/header/index') %>
|
||||
<%- body %>
|
||||
<footer class='page-footer'>
|
||||
<%- partial('_partial/footer') %>
|
||||
<%- partial('_partial/main/footer') %>
|
||||
</footer>
|
||||
<%- partial('_partial/menubtn') %>
|
||||
</div>
|
||||
</div>
|
||||
<div class='scripts'>
|
||||
<%- partial('_partial/scripts/index') %>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<%
|
||||
if (page.class == undefined) {
|
||||
page.class = 'post';
|
||||
if (page.menu_id == undefined) {
|
||||
page.menu_id = 'post';
|
||||
}
|
||||
if (page.header == undefined) {
|
||||
page.header = false;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<%
|
||||
if (page.class == undefined) {
|
||||
page.class = 'post';
|
||||
if (page.menu_id == undefined) {
|
||||
page.menu_id = 'post';
|
||||
}
|
||||
%>
|
||||
<% if (site.tags.length) { %>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<%
|
||||
if (page.class == undefined) {
|
||||
page.class = 'wiki';
|
||||
if (page.menu_id == undefined) {
|
||||
page.menu_id = 'wiki';
|
||||
}
|
||||
if (page.layout == undefined) {
|
||||
page.layout = 'index';
|
||||
|
|
|
@ -10,9 +10,9 @@ hexo.on('generateBefore', () => {
|
|||
hexo.on('ready', () => {
|
||||
const { version } = require('../../package.json');
|
||||
hexo.log.info(`
|
||||
===================================================
|
||||
Stellar ${version}
|
||||
Docs: https://xaoxuu.com/wiki/stellar/
|
||||
Repo: https://github.com/xaoxuu/hexo-theme-stellar/
|
||||
===================================================`);
|
||||
=======================================================
|
||||
Stellar ${version}
|
||||
Docs: https://xaoxuu.com/wiki/stellar/
|
||||
Repo: https://github.com/xaoxuu/hexo-theme-stellar/
|
||||
=======================================================`);
|
||||
});
|
|
@ -3,18 +3,23 @@
|
|||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var util = require('hexo-util');
|
||||
|
||||
// Examples of helper
|
||||
hexo.extend.helper.register('popular_posts_wrapper', function(args){
|
||||
if (!args || !args.json || args.json.length == 0) return "";
|
||||
const title = args.title;
|
||||
const json = args.json.json;
|
||||
const cls = args.json.class;
|
||||
if (json == undefined || json.length == 0) {
|
||||
return '';
|
||||
}
|
||||
const cfg = hexo.theme.config.article.related_posts;
|
||||
if (cfg.enable != true) return;
|
||||
var returnHTML = "";
|
||||
var div = `
|
||||
<div class="related_posts">
|
||||
<section class='header'>
|
||||
<div class='title cap cyan'>${cfg.title}</div>
|
||||
<div class='title cap cyan'>${title}</div>
|
||||
</section>
|
||||
<section class='body'>
|
||||
`;
|
||||
|
@ -36,18 +41,18 @@ hexo.extend.helper.register('popular_posts_wrapper', function(args){
|
|||
el += '<span class="title">' + list.title + '</span>';
|
||||
|
||||
if (list.excerpt && list.excerpt.length > 0) {
|
||||
el += '<span class="excerpt">' + util.truncate(util.stripHTML(list.excerpt), {length: 64}) + '</span>';
|
||||
el += '<span class="excerpt">' + util.truncate(util.stripHTML(list.excerpt), {length: 120}) + '</span>';
|
||||
}
|
||||
|
||||
el += '</a>';
|
||||
return el;
|
||||
}
|
||||
|
||||
for(var i = 0; i < args.json.length; i++) {
|
||||
returnHTML += generateHTML(args.json[i]);
|
||||
for(var i = 0; i < json.length; i++) {
|
||||
returnHTML += generateHTML(json[i]);
|
||||
}
|
||||
|
||||
if (returnHTML != "") returnHTML = "<div class=\"" + args.class + "\">" + returnHTML + "</div>";
|
||||
if (returnHTML != "") returnHTML = "<div class=\"" + cls + "\">" + returnHTML + "</div>";
|
||||
div += returnHTML;
|
||||
div += '</section></div>';
|
||||
return div;
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
'use strict';
|
||||
|
||||
hexo.extend.helper.register('stellar_info', function(args){
|
||||
const repo = 'https://github.com/xaoxuu/hexo-theme-stellar';
|
||||
const wiki = 'https://xaoxuu.com/wiki/stellar/';
|
||||
const issues = repo + '/issues/';
|
||||
const { version } = require('../../package.json');
|
||||
const cfg = hexo.theme.config.stellar;
|
||||
if (!args) {
|
||||
return repo;
|
||||
} else if (args == 'name') {
|
||||
return 'Stellar';
|
||||
} else if (args == 'version') {
|
||||
return version;
|
||||
} else if (args == 'issues') {
|
||||
return repo + '/issues/'
|
||||
} else if (args == 'tree') {
|
||||
return repo + '/tree/' + version;
|
||||
}
|
||||
return '';
|
||||
});
|
|
@ -0,0 +1,44 @@
|
|||
'use strict';
|
||||
|
||||
var util = require('hexo-util');
|
||||
|
||||
hexo.extend.helper.register('stellar_meta', function(args, page){
|
||||
if (['robots', 'description'].includes(args) == false) {
|
||||
return '';
|
||||
}
|
||||
function meta(str) {
|
||||
if (str && str.length > 0) {
|
||||
return str;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
if (args == 'robots') {
|
||||
if (page.__index == true) {
|
||||
return '';
|
||||
}
|
||||
if (page.robots) {
|
||||
meta(page.robots);
|
||||
} else {
|
||||
// default rule
|
||||
if (['post', 'wiki', 'index'].includes(page.layout) == false) {
|
||||
meta('noindex,nofollow');
|
||||
}
|
||||
}
|
||||
} else if (args == 'description') {
|
||||
if (page.__index == true) {
|
||||
meta(hexo.config.description);
|
||||
} else if (page.description) {
|
||||
meta(util.stripHTML(page.description));
|
||||
} else if (['post', 'wiki'].includes(page.layout)) {
|
||||
var description = '';
|
||||
if (page.excerpt && page.excerpt.length > 0) {
|
||||
description = util.stripHTML(page.excerpt);
|
||||
} else if (page.content && page.content.length > 0) {
|
||||
description = util.truncate(util.stripHTML(page.content), {length: 160});
|
||||
}
|
||||
meta(description);
|
||||
}
|
||||
}
|
||||
return '';
|
||||
});
|
|
@ -1,4 +1,4 @@
|
|||
.posts .paginator-wrap
|
||||
.post-list .paginator-wrap
|
||||
display: flex
|
||||
justify-content: space-between
|
||||
align-items: center
|
||||
|
|
Loading…
Reference in New Issue