diff --git a/LICENSE b/LICENSE index 0ad8407..98d68da 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 ZHANG Ruipeng +Copyright (c) 2015 PPOffice Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/_config.yml.example b/_config.yml.example index cd1eb00..a01feb6 100644 --- a/_config.yml.example +++ b/_config.yml.example @@ -1,98 +1,95 @@ -# Menus +# Website's icon url. +favicon: /favicon.png + +# Open Graph metadata (https://hexo.io/docs/helpers.html#open-graph) +open_graph: + fb_app_id: + fb_admins: + twitter_id: + google_plus: + +rss: + +# Website's logo shown on the left of the navigation bar. +logo: + +# Navigation bar menu links. menu: - Home: . - Archives: archives - Categories: categories - Tags: tags - About: about + Home: / + Archives: /archives + Categories: /categories + Tags: /tags + About: /about -# Customize -customize: - logo: - enabled: true - width: 40 - height: 40 - url: images/logo.png - profile: - enabled: true # Whether to show profile bar - fixed: true - avatar: css/images/avatar.png - gravatar: # Gravatar email address, if you enable Gravatar, your avatar config will be overriden - author: PPOffice - author_title: Web Developer & Designer - location: Harbin, China - follow: https://github.com/ppoffice/ - highlight: monokai - sidebar: right # sidebar position, options: left, right or leave it empty - thumbnail: true # enable posts thumbnail, options: true, false - favicon: # path to favicon - social_links: - github: http://github.com/ppoffice/hexo-theme-icarus - twitter: / - facebook: / - dribbble: / - rss: / - social_link_tooltip: true # enable the social link tooltip, options: true, false +article: + highlight: atom-one-light + thumbnail: true -# Widgets -widgets: - - recent_posts - - category - - archive - - tag - - tagcloud - - links - -# Search search: - insight: true # you need to install `hexo-generator-json-content` before using Insight Search - swiftype: # enter swiftype install key here - baidu: false # you need to disable other search engines to use Baidu search, options: true, false + type: insight -# Comment comment: - disqus: # enter disqus shortname here - duoshuo: # enter duoshuo shortname here - youyan: # enter youyan uid here - facebook: # enter true to enable - isso: # enter the domain name of your own comment isso server eg. comments.example.com - changyan: # please fill in `appid` and `conf` to enable - appid: - conf: - gitment: - owner: #your github ID - repo: #the repo to store comments - #Register an OAuth application, and you will get a client ID and a client secret. - client_id: #your client ID - client_secret: #your client secret - livere: # enter livere uid here - valine: # Valine Comment System https://github.com/xCss/Valine - on: # enter true to enable - appId: # enter the leancloud application appId here - appKey: # enter the leancloud application appKey here - notify: # enter true to enable https://github.com/xCss/Valine/wiki/Valine-%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F%E4%B8%AD%E7%9A%84%E9%82%AE%E4%BB%B6%E6%8F%90%E9%86%92%E8%AE%BE%E7%BD%AE - verify: # enter true to enable - placeholder: Just Do It # enter the comment box placeholder - + type: disqus + shortname: hexo-theme-icarus -# Share -share: default # options: jiathis, bdshare, addtoany, default +share: + type: sharethis + install_url: + +widgets: + - type: profile + position: left + author: PPOffice + author_title: Web Developer + location: Earth, Solar System + avatar: + gravatar: + follow_link: http://github.com/ppoffice + social_links: + Github: + icon: fab fa-github + url: http://github.com/ppoffice + Facebook: + icon: fab fa-facebook + url: http://facebook.com + Twitter: + icon: fab fa-twitter + url: http://twitter.com + Dribbble: + icon: fab fa-dribbble + url: http://dribbble.com + RSS: + icon: fas fa-rss + url: / + - type: toc + position: left + - type: links + position: left + links: + Hexo: https://hexo.io + Github: https://github.com/ppoffice + - type: category + position: left + - type: tagcloud + position: left + - type: recent_posts + position: right + - type: archive + position: right + - type: tag + position: right -# Plugins plugins: - lightgallery: true # options: true, false - justifiedgallery: true # options: true, false - google_analytics: # enter the tracking ID for your Google Analytics - google_site_verification: # enter Google site verification code - baidu_analytics: # enter Baidu Analytics hash key - mathjax: false # options: true, false + gallery: true + outdated-browser: true + animejs: true + mathjax: true + google-analytics: + tracking_id: + baidu-analytics: + tracking_id: -# Miscellaneous -miscellaneous: - open_graph: # see http://ogp.me - fb_app_id: - fb_admins: - twitter_id: - google_plus: - links: - Hexo: http://hexo.io +providers: + cdn: + fontcdn: + iconcdn: \ No newline at end of file diff --git a/_source/about/index.md b/_source/about/index.md deleted file mode 100644 index fbeeeda..0000000 --- a/_source/about/index.md +++ /dev/null @@ -1,4 +0,0 @@ -title: "About" -layout: "page" ---- - diff --git a/_source/categories/index.md b/_source/categories/index.md deleted file mode 100644 index 969529b..0000000 --- a/_source/categories/index.md +++ /dev/null @@ -1,3 +0,0 @@ -title: "Categories" -layout: "categories" ---- diff --git a/_source/tags/index.md b/_source/tags/index.md deleted file mode 100644 index f91f0a6..0000000 --- a/_source/tags/index.md +++ /dev/null @@ -1,3 +0,0 @@ -title: "Tags" -layout: "tags" ---- diff --git a/includes/filters/highlight.js b/includes/filters/highlight.js new file mode 100644 index 0000000..31ff0c5 --- /dev/null +++ b/includes/filters/highlight.js @@ -0,0 +1,25 @@ +const cheerio = require('cheerio'); + +module.exports = function (hexo) { + function patchCodeHighlight(content) { + const $ = cheerio.load(content, { decodeEntities: false }); + $('figure.highlight').addClass('hljs'); + $('figure.highlight .code .line span').each(function () { + const classes = $(this).attr('class').split(' '); + if (classes.length === 1) { + $(this).addClass('hljs-' + classes[0]); + $(this).removeClass(classes[0]); + } + }); + return $.html(); + } + + /** + * Add .hljs class name to the code blocks and code elements + */ + hexo.extend.filter.register('after_post_render', function (data) { + data.content = data.content ? patchCodeHighlight(data.content) : data.content; + data.excerpt = data.excerpt ? patchCodeHighlight(data.excerpt) : data.excerpt; + return data; + }); +} \ No newline at end of file diff --git a/includes/generators/categories.js b/includes/generators/categories.js new file mode 100644 index 0000000..c8eb846 --- /dev/null +++ b/includes/generators/categories.js @@ -0,0 +1,14 @@ +/** + * Category list page generator + */ +module.exports = function (hexo) { + hexo.extend.generator.register('categories', function (locals) { + return { + path: 'categories/', + layout: ['categories'], + data: Object.assign({}, locals, { + __categories: true + }) + }; + }); +} \ No newline at end of file diff --git a/includes/generators/category.js b/includes/generators/category.js new file mode 100644 index 0000000..0f019e3 --- /dev/null +++ b/includes/generators/category.js @@ -0,0 +1,34 @@ +const pagination = require('hexo-pagination'); + +module.exports = function (hexo) { + // ATTENTION: This will override the default category generator! + hexo.extend.generator.register('category', function(locals) { + const config = this.config; + const perPage = config.category_generator.per_page; + const paginationDir = config.pagination_dir || 'page'; + + function findParent(category) { + let parents = []; + if (category && category.hasOwnProperty('parent')) { + const parent = locals.categories.filter(cat => cat._id === category.parent).first(); + parents = [parent].concat(findParent(parent)); + } + return parents; + } + + return locals.categories.reduce(function(result, category){ + const posts = category.posts.sort('-date'); + const data = pagination(category.path, posts, { + perPage: perPage, + layout: ['category', 'archive', 'index'], + format: paginationDir + '/%d/', + data: { + category: category.name, + parents: findParent(category) + } + }); + + return result.concat(data); + }, []); + }); +} \ No newline at end of file diff --git a/includes/generators/insight.js b/includes/generators/insight.js new file mode 100644 index 0000000..ce5cc3a --- /dev/null +++ b/includes/generators/insight.js @@ -0,0 +1,37 @@ +const util = require('hexo-util'); + +/** + * Insight search content.json generator. + */ +module.exports = function (hexo) { + hexo.extend.generator.register('insight', function (locals) { + const url_for = hexo.extend.helper.get('url_for').bind(this); + function minify(str) { + return util.stripHTML(str).trim().replace(/\n/g, ' ').replace(/\s+/g, ' '); + } + function postMapper(post) { + return { + title: post.title, + text: minify(post.content), + link: url_for(post.path) + } + } + function tagMapper(tag) { + return { + name: tag.name, + slug: tag.slug, + link: url_for(tag.path) + } + } + const site = { + pages: locals.pages.map(postMapper), + posts: locals.posts.map(postMapper), + tags: locals.tags.map(tagMapper), + categories: locals.categories.map(tagMapper) + }; + return { + path: '/content.json', + data: JSON.stringify(site) + }; + }); +} \ No newline at end of file diff --git a/includes/generators/tags.js b/includes/generators/tags.js new file mode 100644 index 0000000..e6a8a92 --- /dev/null +++ b/includes/generators/tags.js @@ -0,0 +1,14 @@ +/** + * Tag list page generator + */ +module.exports = function (hexo) { + hexo.extend.generator.register('tags', function (locals) { + return { + path: 'tags/', + layout: ['tags'], + data: Object.assign({}, locals, { + __tags: true + }) + }; + }); +} \ No newline at end of file diff --git a/includes/helpers/cdn.js b/includes/helpers/cdn.js new file mode 100644 index 0000000..c45e701 --- /dev/null +++ b/includes/helpers/cdn.js @@ -0,0 +1,51 @@ +/** + * CDN static file resolvers. + * + * @example + * <%- cdn(package, version, filename) %> + * <%- fontcdn(fontName) %> + * <%- iconcdn() %> + */ +const cdn_providers = { + cdnjs: 'https://cdnjs.cloudflare.com/ajax/libs/${ package }/${ version }/${ filename }', + jsdelivr: 'https://cdn.jsdelivr.net/npm/${ package }@${ version }/${ filename }', + jsdelivr_github: 'https://cdn.jsdelivr.net/gh/user/${ package }@${ version }/${ filename }', + unpkg: 'https://unpkg.com/${ package }@${ version }/${ filename }' +}; + +const font_providers = { + google: 'https://fonts.googleapis.com/css?family=${ fontname }' +}; + +const icon_providers = { + fontawesome: 'https://use.fontawesome.com/releases/v5.4.1/css/all.css', + material: 'https://fonts.googleapis.com/icon?family=Material+Icons' +}; + +module.exports = function (hexo) { + hexo.extend.helper.register('cdn', function (package, version, filename, provider = 'cdnjs') { + provider = hexo.extend.helper.get('get_config').bind(this)('providers.cdn', provider); + if (provider != null && cdn_providers.hasOwnProperty(provider)) { + provider = cdn_providers[provider]; + } + return provider.replace(/\${\s*package\s*}/gi, package) + .replace(/\${\s*version\s*}/gi, version) + .replace(/\${\s*filename\s*}/gi, filename); + }); + + hexo.extend.helper.register('fontcdn', function (fontName, provider = 'google') { + provider = hexo.extend.helper.get('get_config').bind(this)('providers.font', provider); + if (provider != null && font_providers.hasOwnProperty(provider)) { + provider = font_providers[provider]; + } + return provider.replace(/\${\s*fontname\s*}/gi, fontName); + }); + + hexo.extend.helper.register('iconcdn', function (provider = 'fontawesome') { + provider = hexo.extend.helper.get('get_config').bind(this)('providers.icon', provider); + if (provider != null && icon_providers.hasOwnProperty(provider)) { + provider = icon_providers[provider]; + } + return provider; + }); +} \ No newline at end of file diff --git a/includes/helpers/config.js b/includes/helpers/config.js new file mode 100644 index 0000000..558edda --- /dev/null +++ b/includes/helpers/config.js @@ -0,0 +1,37 @@ +/** + * Theme configuration helpers. + * + * @description Test if a configuration is set or fetch its value. If `exclude_page` is set, the helpers will + * not look up configurations in the current page's front matter. + * @example + * <%- has_config(config_name, exclude_page) %> + * <%- get_config(config_name, default_value, exclude_page) %> + */ +module.exports = function (hexo) { + function readProperty(object, path) { + const paths = path.split('.'); + for (let path of paths) { + if (typeof (object) === 'undefined' || object === null || !object.hasOwnProperty(path)) { + return null; + } + object = object[path]; + } + return object; + } + + hexo.extend.helper.register('get_config', function (configName, defaultValue = null, excludePage = false) { + const value = readProperty(Object.assign({}, this.config, hexo.theme.config, + !excludePage ? this.page : {}), configName); + return value == null ? defaultValue : value; + }); + + hexo.extend.helper.register('has_config', function (configName, excludePage = false) { + const readProperty = hexo.extend.helper.get('get_config').bind(this); + return readProperty(configName, null, excludePage) != null; + }); + + hexo.extend.helper.register('get_config_from_obj', function (object, configName, defaultValue = null) { + const value = readProperty(object, configName); + return value == null ? defaultValue : value; + }); +} \ No newline at end of file diff --git a/includes/helpers/layout.js b/includes/helpers/layout.js new file mode 100644 index 0000000..e92df26 --- /dev/null +++ b/includes/helpers/layout.js @@ -0,0 +1,27 @@ +/** + * Helper functions for controlling layout. + * +* @example +* <%- get_widgets(position) %> +* <%- has_column() %> +* <%- column_count() %> + */ +module.exports = function (hexo) { + hexo.extend.helper.register('get_widgets', function (position) { + const widgets = hexo.extend.helper.get('get_config').bind(this)('widgets', []); + return widgets.filter(widget => widget.hasOwnProperty('position') && widget.position === position); + }); + + hexo.extend.helper.register('has_column', function (position) { + const getWidgets = hexo.extend.helper.get('get_widgets').bind(this); + return getWidgets(position).length > 0; + }); + + hexo.extend.helper.register('column_count', function () { + let columns = 1; + const hasColumn = hexo.extend.helper.get('has_column').bind(this); + columns += hasColumn('left') ? 1 : 0; + columns += hasColumn('right') ? 1 : 0; + return columns; + }); +} \ No newline at end of file diff --git a/includes/helpers/override.js b/includes/helpers/override.js new file mode 100644 index 0000000..3846386 --- /dev/null +++ b/includes/helpers/override.js @@ -0,0 +1,125 @@ +/** + * Helper functions that override Hexo built-in helpers. + * + * @example +* <%- _list_archives() %> +* <%- _list_categories() %> +* <%- _list_tags() %> +* <%- _toc() %> + */ +const _ = require('lodash'); +const cheerio = require('cheerio'); + +module.exports = function (hexo) { + hexo.extend.helper.register('_list_archives', function () { + const $ = cheerio.load(this.list_archives(), { decodeEntities: false }); + const archives = []; + $('.archive-list-item').each(function () { + archives.push({ + url: $(this).find('.archive-list-link').attr('href'), + name: $(this).find('.archive-list-link').text(), + count: $(this).find('.archive-list-count').text() + }); + }); + return archives; + }); + + hexo.extend.helper.register('_list_categories', function () { + const $ = cheerio.load(this.list_categories({ depth: 2 }), { decodeEntities: false }); + function traverse(root) { + const categories = []; + root.find('> .category-list-item').each(function () { + const category = { + url: $(this).find('> .category-list-link').attr('href'), + name: $(this).find('> .category-list-link').text(), + count: $(this).find('> .category-list-count').text() + }; + if ($(this).find('> .category-list-child').length) { + category['children'] = traverse($(this).find('> .category-list-child')); + } + categories.push(category); + }); + return categories; + } + return traverse($('.category-list')); + }); + + hexo.extend.helper.register('_list_tags', function () { + const $ = cheerio.load(this.list_tags(), { decodeEntities: false }); + const tags = []; + $('.tag-list-item').each(function () { + tags.push({ + url: $(this).find('.tag-list-link').attr('href'), + name: $(this).find('.tag-list-link').text(), + count: $(this).find('.tag-list-count').text() + }); + }); + return tags; + }); + + /** + * Export a tree of headings of an article + * { + * "1": { + * "id": "How-to-enable-table-of-content-for-a-post", + * "index": "1" + * }, + * "2": { + * "1": { + * "1": { + * "id": "Third-level-title", + * "index": "2.1.1" + * }, + * "id": "Second-level-title", + * "index": "2.1" + * }, + * "2": { + * "id": "Another-second-level-title", + * "index": "2.2" + * }, + * "id": "First-level-title", + * "index": "2" + * } + * } + */ + hexo.extend.helper.register('_toc', (content) => { + const $ = cheerio.load(content, { decodeEntities: false }); + const toc = {}; + const levels = [0, 0, 0]; + // Get top 3 headings that are present in the content + const tags = [1, 2, 3, 4, 5, 6].map(i => 'h' + i).filter(h => $(h).length > 0).slice(0, 3); + if (tags.length === 0) { + return toc; + } + $(tags.join(',')).each(function () { + const level = tags.indexOf(this.name); + const id = $(this).attr('id'); + const text = _.escape($(this).text()); + + for (let i = 0; i < levels.length; i++) { + if (i > level) { + levels[i] = 0; + } else if (i < level) { + if (levels[i] === 0) { + // if headings start with a lower level heading, set the former heading index to 1 + // e.g. h3, h2, h1, h2, h3 => 1.1.1, 1.2, 2, 2.1, 2.1.1 + levels[i] = 1; + } + } else { + levels[i] += 1; + } + } + let node = toc; + for (let i of levels.slice(0, level + 1)) { + if (!node.hasOwnProperty(i)) { + node[i] = {}; + } + node = node[i]; + } + node.id = id; + node.text = text; + node.index = levels.slice(0, level + 1).join('.'); + }); + return toc; + }); +} \ No newline at end of file diff --git a/includes/helpers/page.js b/includes/helpers/page.js new file mode 100644 index 0000000..c07a09d --- /dev/null +++ b/includes/helpers/page.js @@ -0,0 +1,96 @@ +/** +* Helper functions for page/post. +* +* @example +* <%- is_categories(page) %> +* <%- is_tags(page) %> +* <%- page_title(page) %> +* <%- meta(post) %> +* <%- has_thumbnail(post) %> +* <%- get_thumbnail(post) %> +*/ +module.exports = function (hexo) { + function trim(str) { + return str.trim().replace(/^"(.*)"$/, '$1').replace(/^'(.*)'$/, '$1'); + } + + function split(str, sep) { + var result = []; + var matched = null; + while (matched = sep.exec(str)) { + result.push(matched[0]); + } + return result; + } + + hexo.extend.helper.register('is_categories', function (page = null) { + return (page === null ? this.page : page).__categories; + }); + + hexo.extend.helper.register('is_tags', function (page = null) { + return (page === null ? this.page : page).__tags; + }); + + /** + * Generate html head title based on page type + */ + hexo.extend.helper.register('page_title', function (page = null) { + page = page === null ? this.page : page; + let title = page.title; + + if (this.is_archive()) { + title = this._p('common.archive', Infinity); + if (this.is_month()) { + title += ': ' + page.year + '/' + page.month; + } else if (this.is_year()) { + title += ': ' + page.year; + } + } else if (this.is_category()) { + title = this._p('common.category', 1) + ': ' + page.category; + } else if (this.is_tag()) { + title = this._p('common.tag', 1) + ': ' + page.tag; + } else if (this.is_categories()) { + title = this._p('common.category', Infinity); + } else if (this.is_tags()) { + title = this._p('common.tag', Infinity); + } + + const siteTitle = hexo.extend.helper.get('get_config').bind(this)('title', '', true); + return [title, siteTitle].filter(str => typeof (str) !== 'undefined' && str.trim() !== '').join(' - '); + }); + + hexo.extend.helper.register('meta', function (post) { + var metas = post.meta || []; + var output = ''; + var metaDOMArray = metas.map(function (meta) { + var entities = split(meta, /(?:[^\\;]+|\\.)+/g); + var entityArray = entities.map(function (entity) { + var keyValue = split(entity, /(?:[^\\=]+|\\.)+/g); + if (keyValue.length < 2) { + return null; + } + var key = trim(keyValue[0]); + var value = trim(keyValue[1]); + return key + '="' + value + '"'; + }).filter(function (entity) { + return entity; + }); + return ''; + }); + return metaDOMArray.join('\n'); + }); + + hexo.extend.helper.register('has_thumbnail', function (post) { + const getConfig = hexo.extend.helper.get('get_config').bind(this); + const allowThumbnail = getConfig('article.thumbnail', true); + if (!allowThumbnail) { + return false; + } + return post.hasOwnProperty('thumbnail') && post.thumbnail; + }); + + hexo.extend.helper.register('get_thumbnail', function (post) { + const hasThumbnail = hexo.extend.helper.get('has_thumbnail').bind(this)(post); + return this.url_for(hasThumbnail ? post.thumbnail : 'images/thumbnail.png'); + }); +} \ No newline at end of file diff --git a/includes/helpers/site.js b/includes/helpers/site.js new file mode 100644 index 0000000..ef50a0d --- /dev/null +++ b/includes/helpers/site.js @@ -0,0 +1,53 @@ +/** + * Helper functions related the site properties. + * + * @example +* <%- is_same_link(url_a, url_b) %> +* <%- post_count() %> +* <%- category_count() %> +* <%- tag_count() %> +* <%- duration() %> +* <%- word_count(content) %> + */ +const moment = require('moment'); + +module.exports = function (hexo) { + hexo.extend.helper.register('is_same_link', function (a, b) { + function santize(url) { + let paths = url.replace(/(^\w+:|^)\/\//, '').split('#')[0].split('/').filter(p => p.trim() !== ''); + if (paths.length > 0 && paths[paths.length - 1].trim() === 'index.html') { + paths = paths.slice(0, paths.length - 1) + } + return paths.join('/'); + } + return santize(this.url_for(a)) == santize(this.url_for(b)); + }); + + hexo.extend.helper.register('post_count', function () { + return this.site.posts.length; + }); + + hexo.extend.helper.register('category_count', function () { + return this.site.categories.filter(category => category.length).length; + }); + + hexo.extend.helper.register('tag_count', function () { + return this.site.tags.filter(tag => tag.length).length; + }); + + /** + * Export moment.duration + */ + hexo.extend.helper.register('duration', function () { + return moment.duration.apply(moment, arguments); + }); + + /** + * Get the word count of a paragraph. + */ + hexo.extend.helper.register('word_count', function (content) { + content = content.replace(/<\/?[a-z][^>]*>/gi, ''); + content = content.trim(); + return content ? (content.match(/[\u00ff-\uffff]|[a-zA-Z]+/g) || []).length : 0; + }); +} \ No newline at end of file diff --git a/includes/tasks/check_config.js b/includes/tasks/check_config.js new file mode 100644 index 0000000..e15ed1e --- /dev/null +++ b/includes/tasks/check_config.js @@ -0,0 +1,10 @@ +const fs = require('fs'); +const path = require('path'); +const logger = require('hexo-log')(); + +const conf = path.join(__dirname, '../..', '_config.yml'); + +logger.info('Checking if the configuration file exists'); +if (!fs.existsSync(conf)) { + logger.warn(`${conf} is not found. Please create one from the template _config.yml.example.`) +} \ No newline at end of file diff --git a/includes/tasks/check_deps.js b/includes/tasks/check_deps.js new file mode 100644 index 0000000..0e5027f --- /dev/null +++ b/includes/tasks/check_deps.js @@ -0,0 +1,33 @@ +const logger = require('hexo-log')(); + +function checkDependency(name) { + try { + require.resolve(name); + return true; + } catch(e) { + logger.error(`Package ${name} is not installed.`) + } + return false; +} + +logger.info('Checking dependencies'); +const missingDeps = [ + // 'moment', + // 'lodash', + // 'cheerio', + // 'js-yaml', + // 'highlight.js', + // 'hexo-util', + 'hexo-log', + 'hexo-generator-archive', + 'hexo-generator-category', + 'hexo-generator-index', + 'hexo-generator-tag', + 'hexo-renderer-ejs', + 'hexo-renderer-marked', + 'hexo-renderer-stylus', +].map(checkDependency).some(installed => !installed); +if (missingDeps) { + logger.error('Please install the missing dependencies from the root directory of your Hexo site.'); + process.exit(-1); +} diff --git a/includes/tasks/welcome.js b/includes/tasks/welcome.js new file mode 100644 index 0000000..ad2d336 --- /dev/null +++ b/includes/tasks/welcome.js @@ -0,0 +1,5 @@ +const logger = require('hexo-log')(); + +logger.info(`======================================= + Icarus V2 +=============================================`); \ No newline at end of file diff --git a/languages/en.yml b/languages/en.yml index 1084d52..f15825d 100644 --- a/languages/en.yml +++ b/languages/en.yml @@ -1,33 +1,33 @@ -index: - home: 'home' - search: 'Search' - archive: 'archive' - category: 'category' - uncategorized: 'uncategorized' - tag: 'tag' -nav: +common: + archive: + one: 'Archive' + other: 'Archives' + category: + one: 'Category' + other: 'Categories' + tag: + one: 'Tag' + other: 'Tags' + post: + one: 'Post' + other: 'Posts' + prev: 'Previous' next: 'Next' - prev: 'Prev' - older: 'Older' - newer: 'Newer' widget: - recents: 'recent' - archives: 'archives' - categories: 'categories' - links: 'links' - tags: 'tags' - tag_cloud: 'tag cloud' + follow: 'Follow' + recents: 'Recent' + links: 'Links' + tag_cloud: 'Tag Cloud' + catalogue: 'Catalogue' article: more: 'Read More' comments: 'Comments' - share: 'Share' - catalogue: 'Catalogue' -profile: - follow: 'FOLLOW' - post: 'post' - tag: 'tag' - posts: 'posts' - tags: 'tags' + read: 'read' + about: 'About' + words: 'words' +search: + search: 'Search' + hint: 'Type something...' insight: hint: 'Type something...' posts: 'Posts' @@ -35,4 +35,3 @@ insight: categories: 'Categories' tags: 'Tags' untitled: '(Untitled)' - diff --git a/languages/es.yml b/languages/es.yml index 4e49c7e..264c1c6 100644 --- a/languages/es.yml +++ b/languages/es.yml @@ -1,33 +1,34 @@ #By SrWoOoW -index: - home: 'Inicio' - search: 'Buscar' - archive: 'Archivo' - category: 'Categoria' - uncategorized: 'Sin categoría' - tag: 'Etiqueta' -nav: - next: 'Siguiente ' +common: + archive: + one: 'Archivo' + other: 'Archivos' + category: + one: 'Categoria' + other: 'Categorias' + tag: + one: 'Etiqueta' + other: 'Etiquetas' + post: + one: 'Entrada' + other: 'Entradas' prev: 'Anterior' - older: 'Más viejo' - newer: 'Más nuevo' + next: 'Siguiente' widget: - recents: 'Recientes' - archives: 'Archivos' - categories: 'Categorias' - links: 'Links' - tags: 'Etiquetas' - tag_cloud: 'Nube de etiquetas' -article: - comments: 'Comentarios' - share: 'Compartir' - catalogue: 'Catálogo' -profile: follow: 'SEGUIR' - post: 'Entrada' - tag: 'Etiqueta' - posts: 'Entradas' - tags: 'Etiquetas' + recents: 'Recientes' + links: 'Links' + tag_cloud: 'Nube de etiquetas' + catalogue: 'Catálogo' +article: + more: 'Read More' + comments: 'Comentarios' + read: 'read' + about: 'About' + words: 'words' +search: + search: 'Search' + hint: 'Type something...' insight: hint: 'Type something...' posts: 'Entradas' diff --git a/languages/fr.yml b/languages/fr.yml index 28018e9..9bfdbeb 100644 --- a/languages/fr.yml +++ b/languages/fr.yml @@ -1,32 +1,33 @@ -index: - home: 'Racine' - search: 'Rechercher' - archive: 'Archive' - category: 'Catégorie' - uncategorized: 'Sans catégorie' - tag: 'Tag' -nav: - next: 'Suiv' +common: + archive: + one: 'Archive' + other: 'Archives' + category: + one: 'Catégorie' + other: 'Catégories' + tag: + one: 'Tag' + other: 'Tags' + post: + one: 'Article' + other: 'Articles' prev: 'Préc' - older: 'Plus ancien' - newer: 'Plus récent' + next: 'Suiv' widget: - recents: 'Récents' - archives: 'Archives' - categories: 'Catégories' - links: 'Liens' - tags: 'Tags' - tag_cloud: 'Nuage de tags' -article: - comments: 'Commentaires' - share: 'Partager' - catalogue: 'Catalogue' -profile: follow: 'SUIVRE' - post: 'Article' - tag: 'Tag' - posts: 'Articles' - tags: 'Tags' + recents: 'Récents' + links: 'Liens' + tag_cloud: 'Nuage de tags' + catalogue: 'Catalogue' +article: + more: 'Read More' + comments: 'Commentaires' + read: 'read' + about: 'About' + words: 'words' +search: + search: 'Search' + hint: 'Type something...' insight: hint: 'Type something...' posts: 'Articles' diff --git a/languages/id.yml b/languages/id.yml index 3d5e3ff..52c8c54 100644 --- a/languages/id.yml +++ b/languages/id.yml @@ -1,31 +1,33 @@ -index: - home: 'Beranda' - search: 'Cari' - archive: 'Arsip' - category: 'Kategori' - uncategorized: 'Tanpa Kategori' - tag: 'tag' -nav: - next: 'Berikutnya' +common: + archive: + one: 'Arsip' + other: 'Arsip' + category: + one: 'Kategori' + other: 'Kategori' + tag: + one: 'tag' + other: 'tag' + post: + one: 'pos' + other: 'pos' prev: 'Sebelumnya' - older: 'Lebih lama' - newer: 'Lebih baru' + next: 'Berikutnya' widget: - recents: 'Terbaru' - archives: 'Arsip' - categories: 'Kategori' - links: 'tautan' - tags: 'tag' - tag_cloud: 'awan tag' -article: - comments: 'Komentar' - share: 'Bagikan' -profile: follow: 'IKUTI' - post: 'pos' - tag: 'tag' - posts: 'pos' - tags: 'tag' + recents: 'Terbaru' + links: 'tautan' + tag_cloud: 'awan tag' + catalogue: 'Catalogue' +article: + more: 'Read More' + comments: 'Komentar' + read: 'read' + about: 'About' + words: 'words' +search: + search: 'Search' + hint: 'Tulis Sesuatu..' insight: hint: 'Tulis Sesuatu..' posts: 'Pos' diff --git a/languages/ja.yml b/languages/ja.yml index faf9ded..00928c7 100644 --- a/languages/ja.yml +++ b/languages/ja.yml @@ -1,32 +1,33 @@ -index: - home: 'ホーム' - search: '検索' - archive: 'アーカイブ' - category: 'カテゴリ' - uncategorized: '未分類' - tag: 'タグ' -nav: - next: '次' +common: + archive: + one: 'アーカイブ' + other: 'アーカイブ' + category: + one: 'カテゴリ' + other: 'カテゴリ' + tag: + one: 'タグ' + other: 'タグ' + post: + one: '投稿' + other: '投稿' prev: '前' - older: '古い記事' - newer: '新しい記事' + next: '次' widget: - recents: '最近の記事' - archives: 'アーカイブ' - categories: 'カテゴリ' - links: 'リンク' - tags: 'タグ' - tag_cloud: 'タグクラウド' -article: - comments: 'コメント' - share: '共有' - catalogue: 'カタログ' -profile: follow: 'フォローする' - post: '投稿' - tag: 'タグ' - posts: '投稿' - tags: 'タグ' + recents: '最近の記事' + links: 'リンク' + tag_cloud: 'タグクラウド' + catalogue: 'カタログ' +article: + more: 'Read More' + comments: 'コメント' + read: 'read' + about: 'About' + words: 'words' +search: + search: 'Search' + hint: 'Type something...' insight: hint: 'Type something...' posts: '投稿' diff --git a/languages/ko.yml b/languages/ko.yml index 88a5b05..4bf28e1 100644 --- a/languages/ko.yml +++ b/languages/ko.yml @@ -1,33 +1,33 @@ -index: - home: '홈' - search: '검색' - archive: '아카이브' - category: '카테고리' - uncategorized: '미지정' - tag: '태그' -nav: - next: '다음' +common: + archive: + one: '아카이브' + other: '아카이브' + category: + one: '카테고리' + other: '카테고리' + tag: + one: '태그' + other: '태그' + post: + one: '포스트' + other: '포스트' prev: '이전' - older: '이전 글' - newer: '다음 글' + next: '다음' widget: + follow: '팔로우' recents: '최근 글' - archives: '아카이브' - categories: '카테고리' links: '링크' - tags: '태그' tag_cloud: '태그 클라우드' + catalogue: '카탈로그' article: more: '자세히 보기' comments: '댓글' - share: '공유하기' - catalogue: '카탈로그' -profile: - follow: '팔로우' - post: '포스트' - tag: '태그' - posts: '포스트' - tags: '태그' + read: 'read' + about: 'About' + words: 'words' +search: + search: 'Search' + hint: 'Type something...' insight: hint: 'Type something...' posts: '포스트' diff --git a/languages/pt-BR.yml b/languages/pt-BR.yml index 6115cd0..5c1a164 100644 --- a/languages/pt-BR.yml +++ b/languages/pt-BR.yml @@ -1,33 +1,33 @@ -index: - home: 'home' - search: 'Pesquisar' - archive: 'arquivo' - category: 'categoria' - uncategorized: 'Sem categoria' - tag: 'tag' -nav: - next: 'Próximo' +common: + archive: + one: 'Arquivo' + other: 'Arquivos' + category: + one: 'Categoria' + other: 'Categorias' + tag: + one: 'Tag' + other: 'Tags' + post: + one: 'Artigo' + other: 'Artigos' prev: 'Anterior' - older: 'Antigos' - newer: 'Novos' + next: 'Próximo' widget: + follow: 'SEGUIR' recents: 'Recentes' - archives: 'Arquivos' - categories: 'Categorias' links: 'Links' - tags: 'Tags' tag_cloud: 'Nuvem de tags' + catalogue: 'Catálogo' article: more: 'Ler Mais' comments: 'Comentarios' - share: 'Compartilhar' - catalogue: 'Catálogo' -profile: - follow: 'SEGUIR' - post: 'Artigo' - tag: 'Tag' - posts: 'Artigos' - tags: 'Tags' + read: 'read' + about: 'About' + words: 'words' +search: + search: 'Search' + hint: 'Digite alguma coisa...' insight: hint: 'Digite alguma coisa...' posts: 'Artigos' @@ -35,4 +35,3 @@ insight: categories: 'Categorias' tags: 'Tags' untitled: '(Untitled)' - diff --git a/languages/ru.yml b/languages/ru.yml index 5e0e1bc..475f5e5 100644 --- a/languages/ru.yml +++ b/languages/ru.yml @@ -1,33 +1,33 @@ -index: - home: 'Главная' - search: 'Поиск' - archive: 'архив' - category: 'категории' - uncategorized: 'без категории' - tag: 'тег' -nav: - next: 'Далее' +common: + archive: + one: 'архив' + other: 'архивы' + category: + one: 'категории' + other: 'категории' + tag: + one: 'тег' + other: 'теги' + post: + one: 'пост' + other: 'посты' prev: 'Назад' - older: 'Старые' - newer: 'Новые' + next: 'Далее' widget: + follow: 'Подписаться' recents: 'недавние' - archives: 'архивы' - categories: 'категории' links: 'ссылки' - tags: 'теги' tag_cloud: 'облако тегов' + catalogue: 'Каталог' article: more: 'Читать дальше' comments: 'Комментарии' - share: 'Поделиться' - catalogue: 'Каталог' -profile: - follow: 'Подписаться' - post: 'пост' - tag: 'тег' - posts: 'посты' - tags: 'теги' + read: 'read' + about: 'About' + words: 'words' +search: + search: 'Search' + hint: 'Введите что-нибудь...' insight: hint: 'Введите что-нибудь...' posts: 'посты' diff --git a/languages/tr.yml b/languages/tr.yml index 2189334..8a7ba87 100644 --- a/languages/tr.yml +++ b/languages/tr.yml @@ -1,33 +1,33 @@ -index: - home: 'Anasayfa' - search: 'Ara' - archive: 'Arşiv' - category: 'Kategori' - uncategorized: 'Kategorisiz' - tag: 'Etiket' -nav: - next: 'Sonraki' +common: + archive: + one: 'Arşiv' + other: 'Arşivler' + category: + one: 'Kategori' + other: 'Kategoriler' + tag: + one: 'Etiket' + other: 'Etiketler' + post: + one: 'Gönderi' + other: 'Gönderiler' prev: 'Önceki' - older: 'Eski' - newer: 'Yeni' + next: 'Sonraki' widget: + follow: 'TAKİP ET' recents: 'Son' - archives: 'Arşivler' - categories: 'Kategoriler' links: 'Linkler' - tags: 'Etiketler' tag_cloud: 'Etiket bulutu' + catalogue: 'Katalog' article: more: 'Daha fazla oku' comments: 'Yorumlar' - share: 'Paylaş' - catalogue: 'Katalog' -profile: - follow: 'TAKİP ET' - post: 'Gönderi' - tag: 'Etiket' - posts: 'Gönderi' - tags: 'Etiket' + read: 'read' + about: 'About' + words: 'words' +search: + search: 'Search' + hint: 'Bir şeyler yaz...' insight: hint: 'Bir şeyler yaz...' posts: 'Gönderiler' diff --git a/languages/zh-CN.yml b/languages/zh-CN.yml index 6bdc98e..079c78d 100644 --- a/languages/zh-CN.yml +++ b/languages/zh-CN.yml @@ -1,37 +1,37 @@ -index: - home: '主页' - search: '搜索' - archive: '归档' - category: '分类' - uncategorized: '未分类' - tag: '标签' -nav: - next: '下一页' +common: + archive: + one: '文档' + other: '文档' + category: + one: '分类' + other: '分类' + tag: + one: '标签' + other: '标签' + post: + one: '文章' + other: '文章' prev: '上一页' - older: '下一篇' - newer: '上一篇' + next: '下一页' widget: - recents: '最新文章' - archives: '归档' - categories: '分类' - links: '链接' - tags: '标签' - tag_cloud: '标签云' -article: - more: '查看更多' - comments: '评论' - share: '分享到' - catalogue: '文章目录' -profile: follow: '关注我' - post: '文章' - tag: '标签' - posts: '文章' - tags: '标签' + recents: '最新文章' + links: '链接' + tag_cloud: '标签云' + catalogue: '目录' +article: + more: '阅读更多' + comments: '评论' + read: '读完' + about: '大约' + words: '个字' +search: + search: '搜索' + hint: '想要查找什么...' insight: hint: '想要查找什么...' posts: '文章' pages: '页面' categories: '分类' tags: '标签' - untitled: '(未命名)' + untitled: '(无标题)' diff --git a/languages/zh-TW.yml b/languages/zh-TW.yml index 106d16d..6791f2a 100644 --- a/languages/zh-TW.yml +++ b/languages/zh-TW.yml @@ -1,33 +1,33 @@ -index: - home: '主頁' - search: '搜尋' - archive: '歸檔' - category: '分類' - uncategorized: '未分類' - tag: '標籤' -nav: - next: '下一頁' +common: + archive: + one: '歸檔' + other: '歸檔' + category: + one: '分類' + other: '分類' + tag: + one: '標籤' + other: '標籤' + post: + one: '文章' + other: '文章' prev: '上一頁' - older: '下一篇' - newer: '上一篇' + next: '下一頁' widget: + follow: '關注我' recents: '最新文章' - archives: '歸檔' - categories: '分類' links: '連結' - tags: '標籤' tag_cloud: '標籤雲' + catalogue: '文章目錄' article: more: '繼續閱讀' comments: '評論' - share: '分享到' - catalogue: '文章目錄' -profile: - follow: '關注我' - post: '文章' - tag: '標籤' - posts: '文章' - tags: '標籤' + read: 'read' + about: 'About' + words: 'words' +search: + search: '搜索' + hint: 'Type something...' insight: hint: 'Type something...' posts: '文章' diff --git a/layout/archive.ejs b/layout/archive.ejs index 5cedcb3..b6f054a 100644 --- a/layout/archive.ejs +++ b/layout/archive.ejs @@ -1,32 +1,56 @@ -
- <% var last; - page.posts.each(function(post, i) { - var year = post.date.year(); - if (last != year) { - last = year; %> -
- -

<%= year %>

-
- <% } %> -
- -
- <%- partial('common/post/title', { post: post, index: true, class_name: 'timeline-article-title' }) %> - +<% } +if (!page.year) { + let years = {}; + page.posts.each(p => years[p.date.year()] = null); + for (let year of Object.keys(years).sort((a, b) => b - a)) { + let posts = page.posts.filter(p => p.date.year() == year); %> + <%- buildArchive(posts, year, null) %> + <% } +} else { %> +<%- buildArchive(page.posts, page.year, page.month) %> +<% } %> <% if (page.total > 1) { %> - + <%- partial('common/paginator') %> <% } %> \ No newline at end of file diff --git a/layout/categories.ejs b/layout/categories.ejs index bcca277..09655f8 100644 --- a/layout/categories.ejs +++ b/layout/categories.ejs @@ -1,10 +1,30 @@ -
-
- <%= page.title %> +<% function build_list(categories) { + return categories.map(category => { + let result = `
  • + + + ${category.name} + + + ${category.count} + + `; + if (category.hasOwnProperty('children')) { + result += '
      ' + build_list(category.children) + '
    '; + } + return result + '
  • '; + }).join(''); +} +%> +
    +
    +
    -
    - <% if(site.categories.length) { %> - <%- list_categories(site.categories) %> - <% } %> -
    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/layout/category.ejs b/layout/category.ejs index a57e99c..9114435 100644 --- a/layout/category.ejs +++ b/layout/category.ejs @@ -1 +1,14 @@ -<%- partial('common/timeline', { type: 'category' }) %> \ No newline at end of file +
    +
    + +
    +
    +<%- partial('index', { page }) %> \ No newline at end of file diff --git a/layout/comment/changyan.ejs b/layout/comment/changyan.ejs index dc63230..eaddb6b 100644 --- a/layout/comment/changyan.ejs +++ b/layout/comment/changyan.ejs @@ -1,12 +1,14 @@ -<% if (typeof(script) !== 'undefined' && script) { %> - - - +<% if (!has_config('comment.appid') || !has_config('comment.conf')) { %> +
    + You forgot to set the appid or conf for Changyan. Please set it in _config.yml. +
    <% } else { %> -
    +
    + + <% } %> \ No newline at end of file diff --git a/layout/comment/counter.ejs b/layout/comment/counter.ejs deleted file mode 100644 index 849facc..0000000 --- a/layout/comment/counter.ejs +++ /dev/null @@ -1,17 +0,0 @@ -<% if (post.comments) { %> - <% if (theme.comment.disqus) { %> - <%= __('article.comments') %> - <% } else if (theme.comment.duoshuo) { %> - <%= __('article.comments') %> - <% } else if (theme.comment.youyan) { %> - <%= __('article.comments') %> - <% } else if (theme.comment.isso) { %> - <%= __('article.comments') %> - <% } else if (theme.comment.facebook) { %> - 0 <%= __('article.comments') %> - <% } else if (theme.comment.changyan && theme.comment.changyan.appid && theme.comment.changyan.conf) { %> - <%= __('article.comments') %> - <% } else if (theme.comment.livere) { %> - <%= __('article.comments') %> - <% } %> -<% } %> \ No newline at end of file diff --git a/layout/comment/disqus.ejs b/layout/comment/disqus.ejs index ba4a566..f36876d 100644 --- a/layout/comment/disqus.ejs +++ b/layout/comment/disqus.ejs @@ -1,20 +1,22 @@ -<% if (typeof(script) !== 'undefined' && script) { %> - -<% } else { %> -
    - +<% } %> +
    + <% if (!has_config('comment.shortname')) { %> +
    + You forgot to set the shortname for Disqus. Please set it in _config.yml.
    -<% } %> \ No newline at end of file + <% } %> + +
    \ No newline at end of file diff --git a/layout/comment/duoshuo.ejs b/layout/comment/duoshuo.ejs deleted file mode 100644 index 63f4c61..0000000 --- a/layout/comment/duoshuo.ejs +++ /dev/null @@ -1,52 +0,0 @@ -<% if (typeof(script) !== 'undefined' && script) { %> - -<% } else { %> -
    - -<% } %> \ No newline at end of file diff --git a/layout/comment/facebook.ejs b/layout/comment/facebook.ejs index 84dae84..f3c7c69 100644 --- a/layout/comment/facebook.ejs +++ b/layout/comment/facebook.ejs @@ -1,11 +1,8 @@ -<% if (typeof(script) !== 'undefined' && script) { %> -<% } else { %> -
    -<% } %> +
    diff --git a/layout/comment/gitment.ejs b/layout/comment/gitment.ejs index ce681e8..e5e3047 100644 --- a/layout/comment/gitment.ejs +++ b/layout/comment/gitment.ejs @@ -1,17 +1,23 @@ -<% if (typeof(script) !== 'undefined' && script) { %> - - - - <% } else { %> -
    +<% if (!has_config('comment.owner') || !has_config('comment.repo') || !has_config('comment.client_id') || + !has_config('comment.client_secret')) { %> +
    + You forgot to set the owner, repo, client_id, or client_secret for Gitment. + Please set it in _config.yml. +
    +<% } else { %> +
    + + + <% } %> \ No newline at end of file diff --git a/layout/comment/index.ejs b/layout/comment/index.ejs deleted file mode 100644 index 3f6abc6..0000000 --- a/layout/comment/index.ejs +++ /dev/null @@ -1,28 +0,0 @@ -<% if (post.comments) { %> - <% if (theme.comment.disqus) { %> -
    <%- partial('comment/disqus') %>
    - <% } else if (theme.comment.duoshuo) { %> -
    <%- partial('comment/duoshuo') %>
    - <% } else if (theme.comment.youyan) { %> -
    <%- partial('comment/youyan') %>
    - <% } else if (theme.comment.facebook) { %> -
    <%- partial('comment/facebook') %>
    - <% } else if (theme.comment.isso) { %> -
    <%- partial('comment/isso') %>
    - <% } else if (theme.comment.changyan && theme.comment.changyan.appid && theme.comment.changyan.conf) { %> -
    <%- partial('comment/changyan') %>
    - <% } else if (theme.comment.livere) { %> -
    <%- partial('comment/livere') %>
    - <% } else if (theme.comment.valine && - theme.comment.valine.on && - theme.comment.valine.appId && - theme.comment.valine.appKey) { %> -
    <%- partial('comment/valine') %>
    - <% } else if (theme.comment.gitment && - theme.comment.gitment.owner && - theme.comment.gitment.repo && - theme.comment.gitment.client_id && - theme.comment.gitment.client_secret) { %> -
    <%- partial('comment/gitment') %>
    - <% } %> -<% } %> \ No newline at end of file diff --git a/layout/comment/isso.ejs b/layout/comment/isso.ejs index a10e53e..f0942e3 100644 --- a/layout/comment/isso.ejs +++ b/layout/comment/isso.ejs @@ -1,8 +1,10 @@ -<% if (typeof(script) !== 'undefined' && script) { %> - +<% if (!has_config('comment.url')) { %> +
    + You forgot to set the url for Isso. Please set it in _config.yml. +
    <% } else { %> -
    +
    + <% } %> diff --git a/layout/comment/livere.ejs b/layout/comment/livere.ejs index 562d0a1..000ec66 100644 --- a/layout/comment/livere.ejs +++ b/layout/comment/livere.ejs @@ -1,22 +1,22 @@ -<% if (typeof(script) !== 'undefined' && script) { %> - - - - - - +<% if (!has_config('comment.uid')) { %> +
    + You forgot to set the uid for LiveRe. Please set it in _config.yml. +
    <% } else { %> -
    >
    +
    + + +
    <% } %> \ No newline at end of file diff --git a/layout/comment/scripts.ejs b/layout/comment/scripts.ejs deleted file mode 100644 index 6367516..0000000 --- a/layout/comment/scripts.ejs +++ /dev/null @@ -1,26 +0,0 @@ -<% if (theme.comment.disqus) { %> - <%- partial('comment/disqus', { script: true }) %> -<% } else if (theme.comment.duoshuo) { %> - <%- partial('comment/duoshuo', { script: true }) %> -<% } else if (theme.comment.youyan) { %> - <%- partial('comment/youyan', { script: true }) %> -<% } else if (theme.comment.facebook) { %> - <%- partial('comment/facebook', { script: true }) %> -<% } else if (theme.comment.isso) { %> - <%- partial('comment/isso', { script: true }) %> -<% } else if (theme.comment.changyan && theme.comment.changyan.appid && theme.comment.changyan.conf) { %> - <%- partial('comment/changyan', { script: true }) %> -<% } else if (theme.comment.gitment && - theme.comment.gitment.owner && - theme.comment.gitment.repo && - theme.comment.gitment.client_id && - theme.comment.gitment.client_secret) { %> - <%- partial('comment/gitment', { script: true }) %> -<% } else if (theme.comment.livere) { %> - <%- partial('comment/livere', { script: true }) %> -<% } else if (theme.comment.valine && - theme.comment.valine.on && - theme.comment.valine.appId && - theme.comment.valine.appKey) { %> - <%- partial('comment/valine', { script: true }) %> -<% } %> diff --git a/layout/comment/valine.ejs b/layout/comment/valine.ejs index 13f3691..c3af5f7 100644 --- a/layout/comment/valine.ejs +++ b/layout/comment/valine.ejs @@ -1,16 +1,19 @@ -<% if (typeof(script) !== 'undefined' && script) { %> - - - +<% if (!has_config('comment.app_id') || !has_config('comment.app_key')) { %> +
    + You forgot to set the app_id or app_key for Valine. Please set it in _config.yml. +
    <% } else { %> -
    +
    + + + <% } %> \ No newline at end of file diff --git a/layout/comment/youyan.ejs b/layout/comment/youyan.ejs deleted file mode 100644 index d45ed2f..0000000 --- a/layout/comment/youyan.ejs +++ /dev/null @@ -1,5 +0,0 @@ -<% if (typeof(script) !== 'undefined' && script) { %> - -<% } else { %> -
    -<% } %> \ No newline at end of file diff --git a/layout/common/article.ejs b/layout/common/article.ejs index 5464837..0dacfae 100644 --- a/layout/common/article.ejs +++ b/layout/common/article.ejs @@ -1,47 +1,103 @@ -
    -
    - <% if (post.banner) { %> - <%- partial('post/banner') %> - <% } %> - <% if (post.link || post.title) { %> -
    - <%- partial('post/title', { class_name: 'article-title' }) %> - <% if (post.layout != 'page') { %> - - <% } %> -
    - <% } %> - <%- partial('post/gallery') %> -
    - <% if (index && post.excerpt) { %> -

    <%- post.excerpt %>

    -

    - <%= __('article.more') %> -

    - <% } else { %> - <% if (!index && post.toc) { %> -
    - <%= __('article.catalogue') %> - <%- toc(post.content) %> -
    - <% } %> - <%- post.content %> - <% } %> -
    -
    - <%- partial('share/index', { post: post }) %> - <%- partial('comment/counter', { post: post }) %> -
    +
    + <% if (has_thumbnail(post)) { %> + - <% if (!index) { %> - <%- partial('post/nav') %> <% } %> -
    +
    + <% if (post.layout != 'page') { %> + + <% } %> +

    + <% if (index) { %> + <%= post.title %> + <% } else { %> + <%= post.title %> + <% } %> +

    +
    + <%- index && post.excerpt ? post.excerpt : post.content %> +
    + <% if (!index && post.tags && post.tags.length) { %> +
    +
    +
    + # + <%- list_tags(post.tags, { + class: 'has-link-grey ', + show_count: false, + style: 'link' + }) %> +
    +
    +
    + <% } %> + <% if (index && post.excerpt) { %> + + <% } %> + <% if (!index && has_config('share.type')) { %> + <%- partial('share/' + get_config('share.type')) %> + <% } %> +
    +
    -<% if (!index) { %> - <%- partial('comment/index') %> +<% if (!index && (post.prev || post.next)) { %> +
    +
    + <% if (post.prev){ %> + + <% } %> + <% if (post.next){ %> + + <% } %> +
    +
    +<% } %> + +<% if (!index && has_config('comment.type')) { %> +
    +
    +

    <%= __('article.comments') %>

    + <%- partial('comment/' + get_config('comment.type')) %> +
    +
    <% } %> \ No newline at end of file diff --git a/layout/common/footer.ejs b/layout/common/footer.ejs index e9c9067..3b6e11a 100644 --- a/layout/common/footer.ejs +++ b/layout/common/footer.ejs @@ -1,8 +1,39 @@ -