refactor(schema): all specs to schema

This commit is contained in:
ppoffice 2019-12-24 20:24:34 -05:00
parent bb8d05bbed
commit cbb5bcb992
32 changed files with 501 additions and 736 deletions

View File

@ -0,0 +1,44 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "/common/article.json",
"description": "Article related configurations",
"type": "object",
"properties": {
"highlight": {
"type": "object",
"description": "Code highlight settings",
"properties": {
"theme": {
"type": "string",
"description": "Code highlight themes\nhttps://github.com/highlightjs/highlight.js/tree/master/src/styles",
"default": "atom-one-light"
},
"clipboard": {
"type": "string",
"description": "Show copy code button",
"default": true
},
"fold": {
"type": "string",
"description": "Default folding status of the code blocks. Can be \"\", \"folded\", \"unfolded\"",
"enum": [
"",
"folded",
"unfolded"
],
"default": "unfolded"
}
}
},
"thumbnail": {
"type": "boolean",
"description": "Whether to show thumbnail image for every article",
"default": true
},
"readtime": {
"type": "boolean",
"description": "Whether to show estimated article reading time",
"default": true
}
}
}

View File

@ -0,0 +1,35 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "/common/comment.json",
"description": "Comment plugin configurations",
"type": "object",
"oneOf": [
{
"$ref": "/comment/changyan.json"
},
{
"$ref": "/comment/disqus.json"
},
{
"$ref": "/comment/disqusjs.json"
},
{
"$ref": "/comment/facebook.json"
},
{
"$ref": "/comment/gitalk.json"
},
{
"$ref": "/comment/gitment.json"
},
{
"$ref": "/comment/isso.json"
},
{
"$ref": "/comment/livere.json"
},
{
"$ref": "/comment/valine.json"
}
]
}

View File

@ -0,0 +1,25 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "/common/donates.json",
"description": "Donate plugin configurations",
"type": "array",
"items": {
"oneOf": [
{
"$ref": "/donate/alipay.json"
},
{
"$ref": "/donate/buymeacoffee.json"
},
{
"$ref": "/donate/patreon.json"
},
{
"$ref": "/donate/paypal.json"
},
{
"$ref": "/donate/wechat.json"
}
]
}
}

View File

@ -0,0 +1,28 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "/common/footer.json",
"description": "Page footer configurations",
"type": "object",
"properties": {
"links": {
"$ref": "/misc/poly_links.json",
"description": "Links to be shown on the right of the footer section",
"examples": [
{
"Creative Commons": {
"icon": "fab fa-creative-commons",
"url": "https://creativecommons.org/"
},
"Attribution 4.0 International": {
"icon": "fab fa-creative-commons-by",
"url": "https://creativecommons.org/licenses/by/4.0/"
},
"Download on GitHub": {
"icon": "fab fa-github",
"url": "https://github.com/ppoffice/hexo-theme-icarus"
}
}
]
}
}
}

View File

@ -0,0 +1,27 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "/common/footer.json",
"description": "Page metadata configurations",
"type": "object",
"properties": {
"favicon": {
"type": "string",
"description": "URL or path to the website's icon",
"default": "/images/favicon.svg"
},
"canonical_url": {
"type": "string",
"description": "Canonical URL of the current page"
},
"open_graph": {
"$ref": "/misc/open_graph.json"
},
"meta": {
"$ref": "/misc/meta.json"
},
"rss": {
"type": "string",
"description": "URL or path to the website's RSS atom.xml"
}
}
}

View File

@ -0,0 +1,39 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "/common/footer.json",
"description": "Page top navigation bar configurations",
"type": "object",
"properties": {
"menu": {
"type": "object",
"description": "Naviagtion menu items",
"patternProperties": {
".+": {
"type": "string",
"description": "URL or path of the menu link"
}
},
"examples": [
{
"Home": "/",
"Archives": "/archives",
"Categories": "/categories",
"Tags": "/tags",
"About": "/about"
}
]
},
"links": {
"$ref": "/misc/poly_links.json",
"description": "Links to be shown on the right of the navigation bar",
"examples": [
{
"Download on GitHub": {
"icon": "fab fa-github",
"url": "https://github.com/ppoffice/hexo-theme-icarus"
}
}
]
}
}
}

View File

@ -0,0 +1,41 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "/common/plugins.json",
"description": "Plugin configurations",
"type": "object",
"properties": {
"animejs": {
"$ref": "/plugin/animejs.json"
},
"back_to_top": {
"$ref": "/plugin/back_to_top.json"
},
"baidu_analytics": {
"$ref": "/plugin/baidu_analytics.json"
},
"busuanzi": {
"$ref": "/plugin/busuanzi.json"
},
"gallery": {
"$ref": "/plugin/gallery.json"
},
"google_analytics": {
"$ref": "/plugin/google_analytics.json"
},
"hotjar": {
"$ref": "/plugin/hotjar.json"
},
"katex": {
"$ref": "/plugin/katex.json"
},
"mathjax": {
"$ref": "/plugin/mathjax.json"
},
"outdated_browser": {
"$ref": "/plugin/outdated_browser.json"
},
"progressbar": {
"$ref": "/plugin/progressbar.json"
}
}
}

View File

@ -0,0 +1,23 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "/common/providers.json",
"description": "CDN provider settings\nhttps://ppoffice.github.io/hexo-theme-icarus/Configuration/Theme/speed-up-your-site-with-custom-cdn/",
"type": "object",
"properties": {
"cdn": {
"type": "string",
"description": "Name or URL template of the JavaScript and/or stylesheet CDN provider",
"default": "jsdelivr"
},
"fontcdn": {
"type": "string",
"description": "Name or URL template of the webfont CDN provider",
"default": "google"
},
"iconcdn": {
"type": "string",
"description": "Name or URL of the webfont Icon CDN provider",
"default": "fontawesome"
},
}
}

View File

@ -0,0 +1,17 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "/common/search.json",
"description": "Search plugin configurations",
"type": "object",
"oneOf": [
{
"$ref": "/search/baidu.json"
},
{
"$ref": "/search/google_cse.json"
},
{
"$ref": "/search/insight.json"
}
]
}

View File

@ -0,0 +1,23 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "/common/share.json",
"description": "Share plugin configurations",
"type": "object",
"oneOf": [
{
"$ref": "/share/addthis.json"
},
{
"$ref": "/share/addtoany.json"
},
{
"$ref": "/share/bdshare.json"
},
{
"$ref": "/share/sharejs.json"
},
{
"$ref": "/share/sharethis.json"
}
]
}

View File

@ -0,0 +1,30 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "/common/sidebar.json",
"description": "Sidebar configurations.\nPlease be noted that a sidebar is only visible when it has at least one widget",
"type": "object",
"properties": {
"left": {
"type": "object",
"description": "Left sidebar configurations",
"properties": {
"sticky": {
"type": "boolean",
"description": "Whether the sidebar sticks to the top when page scrolls",
"default": false
}
}
},
"right": {
"type": "object",
"description": "Right sidebar configurations",
"properties": {
"sticky": {
"type": "boolean",
"description": "Whether the sidebar sticks to the top when page scrolls",
"default": false
}
}
}
}
}

View File

@ -0,0 +1,36 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "/common/widgets.json",
"description": "Sidebar widget configurations",
"type": "array",
"items": {
"type": "object",
"properties": {
"position": {
"type": "string",
"description": "Where should the widget be placed, left sidebar or right sidebar",
"default": "left"
}
},
"oneOf": [
{
"$ref": "/widget/alipay.json"
},
{
"$ref": "/widget/buymeacoffee.json"
},
{
"$ref": "/widget/patreon.json"
},
{
"$ref": "/widget/paypal.json"
},
{
"$ref": "/widget/wechat.json"
}
],
"required": [
"position"
]
}
}

View File

@ -0,0 +1,68 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "/config.json",
"description": "The configuration file definition",
"type": "object",
"properties": {
"version": {
"type": "string",
"description": "Version of the configuration file"
},
"logo": {
"type": [
"string",
"object"
],
"description": "Path or URL to the website's logo",
"default": "/images/logo.svg",
"properties": {
"text": {
"type": "string",
"description": "Text to be shown in place of the logo image"
}
},
"required": [
"text"
]
},
"head": {
"$ref": "/common/head.json"
},
"navbar": {
"$ref": "/common/navbar.json"
},
"footer": {
"$ref": "/common/footer.json"
},
"article": {
"$ref": "/common/article.json"
},
"search": {
"$ref": "/common/search.json"
},
"comment": {
"$ref": "/common/comment.json"
},
"donates": {
"$ref": "/common/donates.json"
},
"share": {
"$ref": "/common/share.json"
},
"sidebar": {
"$ref": "/common/sidebar.json"
},
"widgets": {
"$ref": "/common/widgets.json"
},
"plugins": {
"$ref": "/common/plugins.json"
},
"providers": {
"$ref": "/common/providers.json"
}
},
"required": [
"version"
]
}

View File

@ -14,7 +14,10 @@
},
"currency_code": {
"type": "string",
"description": "Currency code"
"description": "Currency code",
"examples": [
"USD"
]
}
},
"required": [

View File

@ -3,5 +3,5 @@
"$id": "/plugin/outdated_browser.json",
"description": "Enable the Outdated Browser plugin\nhttp://outdatedbrowser.com/",
"type": "boolean",
"default": true
"default": false
}

View File

@ -16,7 +16,13 @@
"type": "string",
"description": "URL of the site"
}
}
},
"examples": [
{
"Hexo": "https://hexo.io",
"Bulma": "https://bulma.io"
}
]
}
},
"required": [

View File

@ -10,31 +10,72 @@
},
"author": {
"type": "string",
"description": "Author name"
"description": "Author name",
"examples": [
"Your name"
]
},
"author_title": {
"type": "string",
"description": "Author title"
"description": "Author title",
"examples": [
"Your title"
]
},
"location": {
"type": "string",
"description": "Author's current location"
"description": "Author's current location",
"examples": [
"Your location"
]
},
"avatar": {
"type": "string",
"description": "URL or path to the avatar image"
},
"avatar_rounded": {
"type": "boolean",
"description": "Whether show the rounded avatar image",
"default": false
},
"gravatar": {
"type": "string",
"description": "Email address for the Gravatar"
},
"follow_link": {
"type": "string",
"description": "URL or path for the follow button"
"description": "URL or path for the follow button",
"examples": [
"https://github.com/ppoffice"
]
},
"social_links": {
"$ref": "/misc/poly_links.json",
"description": "Links to be shown on the bottom of the profile widget"
"description": "Links to be shown on the bottom of the profile widget",
"examples": [
{
"Github": {
"icon": "fab fa-github",
"url": "https://github.com/ppoffice"
},
"Facebook": {
"icon": "fab fa-facebook",
"url": "https://facebook.com"
},
"Twitter": {
"icon": "fab fa-twitter",
"url": "https://twitter.com"
},
"Dribbble": {
"icon": "fab fa-dribbble",
"url": "https://dribbble.com"
},
"RSS": {
"icon": "fas fa-rss",
"url": "/"
}
}
]
}
},
"required": [

View File

@ -1,35 +0,0 @@
const { doc, type, defaultValue } = require('../common/utils').descriptors;
module.exports = {
[type]: 'object',
[doc]: 'Article display settings',
highlight: {
[type]: 'object',
[doc]: 'Code highlight settings',
theme: {
[type]: 'string',
[doc]: 'Code highlight themes\nhttps://github.com/highlightjs/highlight.js/tree/master/src/styles',
[defaultValue]: 'atom-one-light'
},
clipboard: {
[type]: 'boolean',
[doc]: 'Show code copying button',
[defaultValue]: true
},
fold: {
[type]: 'string',
[doc]: 'Default folding status of the code blocks. Can be "", "folded", "unfolded"',
[defaultValue]: 'unfolded'
}
},
thumbnail: {
[type]: 'boolean',
[doc]: 'Whether to show article thumbnail images',
[defaultValue]: true
},
readtime: {
[type]: 'boolean',
[doc]: 'Whether to show estimate article reading time',
[defaultValue]: true
}
};

View File

@ -1,141 +0,0 @@
const { doc, type, defaultValue, required, requires } = require('../common/utils').descriptors;
const ChangYanSpec = {
appid: {
[type]: 'string',
[doc]: 'Changyan comment app ID',
[required]: true,
[requires]: comment => comment.type === 'changyan'
},
conf: {
[type]: 'string',
[doc]: 'Changyan comment configuration ID',
[required]: true,
[requires]: comment => comment.type === 'changyan'
}
};
const DisqusSpec = {
shortname: {
[type]: 'string',
[doc]: 'Disqus shortname',
[required]: true,
[requires]: comment => comment.type === 'disqus'
}
};
const GitmentGitalkSpec = {
owner: {
[type]: 'string',
[doc]: 'GitHub user ID',
[required]: true,
[requires]: comment => comment.type === 'gitment' || comment.type === 'gitalk'
},
repo: {
[type]: 'string',
[doc]: 'GitHub repo name to store comments',
[required]: true,
[requires]: comment => comment.type === 'gitment' || comment.type === 'gitalk'
},
client_id: {
[type]: 'string',
[doc]: 'GitHub application client ID',
[required]: true,
[requires]: comment => comment.type === 'gitment' || comment.type === 'gitalk'
},
client_secret: {
[type]: 'string',
[doc]: 'GitHub application client secret',
[required]: true,
[requires]: comment => comment.type === 'gitment' || comment.type === 'gitalk'
},
admin: {
[type]: ['string', 'array'],
[doc]: 'GitHub repo owner and collaborators who can can initialize github issues',
[required]: true,
[requires]: comment => comment.type === 'gitalk',
'*': {
[type]: 'string',
[required]: true
}
},
create_issue_manually: {
[type]: 'boolean',
[doc]: 'Create GitHub issue manually for each page',
[defaultValue]: false,
[requires]: comment => comment.type === 'gitalk'
},
distraction_free_mode: {
[type]: 'boolean',
[doc]: 'Facebook-like distraction free mode',
[defaultValue]: false,
[requires]: comment => comment.type === 'gitalk'
}
};
const IssoSpec = {
url: {
[type]: 'string',
[doc]: 'URL to your Isso comment service',
[required]: true,
[requires]: comment => comment.type === 'isso'
}
};
const LiveReSpec = {
uid: {
[type]: 'string',
[doc]: 'LiveRe comment service UID',
[required]: true,
[requires]: comment => comment.type === 'livere'
}
};
const ValineSpec = {
app_id: {
[type]: 'string',
[doc]: 'LeanCloud APP ID',
[required]: true,
[requires]: comment => comment.type === 'valine'
},
app_key: {
[type]: 'string',
[doc]: 'LeanCloud APP key',
[required]: true,
[requires]: comment => comment.type === 'valine'
},
notify: {
[type]: 'boolean',
[doc]: 'Enable email notification when someone comments',
[defaultValue]: false,
[requires]: comment => comment.type === 'valine'
},
verify: {
[type]: 'boolean',
[doc]: 'Enable verification code service',
[defaultValue]: false,
[requires]: comment => comment.type === 'valine'
},
placeholder: {
[type]: 'string',
[doc]: 'Placeholder text in the comment box',
[defaultValue]: 'Say something...',
[requires]: comment => comment.type === 'valine'
}
};
module.exports = {
[type]: 'object',
[doc]: 'Comment plugin settings\nhttps://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Comment',
type: {
[type]: 'string',
[doc]: 'Name of the comment plugin',
[defaultValue]: null
},
...ChangYanSpec,
...DisqusSpec,
...GitmentGitalkSpec,
...IssoSpec,
...LiveReSpec,
...ValineSpec
}

View File

@ -1,26 +0,0 @@
const { version } = require('../../package.json');
const { type, required, defaultValue, doc } = require('../common/utils').descriptors;
module.exports = {
[type]: 'object',
[doc]: 'Root of the configuration file',
[required]: true,
version: {
[type]: 'string',
[doc]: 'Version of the Icarus theme that is currently used',
[required]: true,
[defaultValue]: version
},
...require('./meta.spec'),
navbar: require('./navbar.spec'),
footer: require('./footer.spec'),
article: require('./article.spec'),
search: require('./search.spec'),
comment: require('./comment.spec'),
donate: require('./donate.spec'),
share: require('./share.spec'),
sidebar: require('./sidebar.spec'),
widgets: require('./widgets.spec'),
plugins: require('./plugins.spec'),
providers: require('./providers.spec')
};

View File

@ -1,72 +0,0 @@
const { doc, type, defaultValue, required, requires, format } = require('../common/utils').descriptors;
const DEFAULT_DONATE = [
{
type: 'alipay',
qrcode: ''
},
{
type: 'wechat',
qrcode: ''
},
{
type: 'paypal',
business: '',
currency_code: 'USD'
},
{
type: 'patreon',
url: ''
}
];
const QrcodeSpec = {
qrcode: {
[type]: 'string',
[doc]: 'Qrcode image URL',
[required]: true,
[requires]: donate => donate.type === 'alipay' || donate.type === 'wechat'
}
};
const PaypalSpec = {
business: {
[type]: 'string',
[doc]: 'Paypal business ID or email address',
[required]: true,
[requires]: donate => donate.type === 'paypal'
},
currency_code: {
[type]: 'string',
[doc]: 'Currency code',
[required]: true,
[requires]: donate => donate.type === 'paypal'
}
};
const PatreonSpec = {
url: {
[type]: 'string',
[doc]: 'URL to the Patreon page',
[required]: true,
[requires]: donate => donate.type === 'patreon'
}
};
module.exports = {
[type]: 'array',
[doc]: 'Donation entries\nhttps://ppoffice.github.io/hexo-theme-icarus/categories/Donation/',
[defaultValue]: DEFAULT_DONATE,
'*': {
[type]: 'object',
[doc]: 'Single donation entry settings',
type: {
[type]: 'string',
[doc]: 'Donation entry name',
[required]: true
},
...QrcodeSpec,
...PaypalSpec,
...PatreonSpec
}
}

View File

@ -1,24 +0,0 @@
const { doc, type, defaultValue } = require('../common/utils').descriptors;
module.exports = {
[type]: 'object',
[doc]: 'Footer section link settings',
links: {
...require('./icon_link.spec'),
[doc]: 'Links to be shown on the right of the footer section',
[defaultValue]: {
'Creative Commons': {
icon: 'fab fa-creative-commons',
url: 'https://creativecommons.org/'
},
'Attribution 4.0 International': {
icon: 'fab fa-creative-commons-by',
url: 'https://creativecommons.org/licenses/by/4.0/'
},
'Download on GitHub': {
icon: 'fab fa-github',
url: 'https://github.com/ppoffice/hexo-theme-icarus'
}
}
}
};

View File

@ -1,20 +0,0 @@
const { doc, type, required } = require('../common/utils').descriptors;
module.exports = {
[type]: 'object',
[doc]: 'Link icon settings',
'*': {
[type]: ['string', 'object'],
[doc]: 'Path or URL to the menu item, and/or link icon class names',
icon: {
[required]: true,
[type]: 'string',
[doc]: 'Link icon class names'
},
url: {
[required]: true,
[type]: 'string',
[doc]: 'Path or URL to the menu item'
}
}
};

View File

@ -1,66 +0,0 @@
const { doc, type, defaultValue } = require('../common/utils').descriptors;
module.exports = {
favicon: {
[type]: 'string',
[doc]: 'Path or URL to the website\'s icon',
[defaultValue]: '/images/favicon.svg',
},
meta: {
[type]: 'array',
[doc]: 'Additional HTML meta tags in an array.',
[defaultValue]: null,
'*': {
[type]: 'string',
[doc]: 'Meta tag specified in <attribute>=<value> style.\nE.g., name=theme-color;content=#123456 => <meta name="theme-color" content="#123456">'
}
},
canonical_url: {
[type]: 'string',
[doc]: 'canonical_url of your site',
[defaultValue]: null
},
rss: {
[type]: 'string',
[doc]: 'Path or URL to RSS atom.xml',
[defaultValue]: null
},
logo: {
[type]: ['string', 'object'],
[defaultValue]: '/images/logo.svg',
[doc]: 'Path or URL to the website\'s logo to be shown on the left of the navigation bar or footer',
text: {
[type]: 'string',
[doc]: 'Text to be shown in place of the logo image'
}
},
open_graph: {
[type]: 'object',
[doc]: 'Open Graph metadata\nhttps://hexo.io/docs/helpers.html#open-graph',
fb_app_id: {
[type]: 'string',
[doc]: 'Facebook App ID',
[defaultValue]: null
},
fb_admins: {
[type]: 'string',
[doc]: 'Facebook Admin ID',
[defaultValue]: null
},
twitter_id: {
[type]: 'string',
[doc]: 'Twitter ID',
[defaultValue]: null
},
twitter_site: {
[type]: 'string',
[doc]: 'Twitter site',
[defaultValue]: null
},
google_plus: {
[type]: 'string',
[doc]: 'Google+ profile link',
[defaultValue]: null
}
}
};

View File

@ -1,31 +0,0 @@
const { doc, type, defaultValue } = require('../common/utils').descriptors;
module.exports = {
[type]: 'object',
[doc]: 'Navigation bar link settings',
menu: {
[type]: 'object',
[doc]: 'Navigation bar menu links',
[defaultValue]: {
Home: '/',
Archives: '/archives',
Categories: '/categories',
Tags: '/tags',
About: '/about'
},
'*': {
[type]: 'string',
[doc]: 'Path or URL to the menu item'
}
},
links: {
...require('./icon_link.spec'),
[doc]: 'Navigation bar links to be shown on the right',
[defaultValue]: {
'Download on GitHub': {
icon: 'fab fa-github',
url: 'https://github.com/ppoffice/hexo-theme-icarus'
}
}
}
};

View File

@ -1,68 +0,0 @@
const { doc, type, defaultValue } = require('../common/utils').descriptors;
module.exports = {
[type]: 'object',
[doc]: 'Other plugin settings',
animejs: {
[type]: 'boolean',
[doc]: 'Enable page animations',
[defaultValue]: true
},
gallery: {
[type]: 'boolean',
[doc]: 'Enable the lightGallery and Justified Gallery plugins\nhttps://ppoffice.github.io/hexo-theme-icarus/Plugins/General/gallery-plugin/',
[defaultValue]: true
},
'outdated-browser': {
[type]: 'boolean',
[doc]: 'Enable the Outdated Browser plugin\nhttp://outdatedbrowser.com/',
[defaultValue]: true
},
mathjax: {
[type]: 'boolean',
[doc]: 'Enable the MathJax plugin\nhttps://ppoffice.github.io/hexo-theme-icarus/Plugins/General/mathjax-plugin/',
[defaultValue]: true
},
'back-to-top': {
[type]: 'boolean',
[doc]: 'Show the back to top button on mobile devices',
[defaultValue]: true
},
'google-analytics': {
[type]: ['boolean', 'object'],
[doc]: 'Google Analytics plugin settings\nhttps://ppoffice.github.io/hexo-theme-icarus/Plugins/General/site-analytics-plugin/#Google-Analytics',
tracking_id: {
[type]: 'string',
[doc]: 'Google Analytics tracking id',
[defaultValue]: null
}
},
'baidu-analytics': {
[type]: ['boolean', 'object'],
[doc]: 'Baidu Analytics plugin settings\nhttps://ppoffice.github.io/hexo-theme-icarus/Plugins/General/site-analytics-plugin/#Baidu-Analytics',
tracking_id: {
[type]: 'string',
[doc]: 'Baidu Analytics tracking id',
[defaultValue]: null
}
},
hotjar: {
[type]: ['boolean', 'object'],
[doc]: 'Hotjar user feedback plugin\nhttps://ppoffice.github.io/hexo-theme-icarus/Plugins/General/site-analytics-plugin/#Hotjar',
site_id: {
[type]: ['string', 'number'],
[doc]: 'Hotjar site id',
[defaultValue]: null
}
},
progressbar: {
[type]: 'boolean',
[doc]: 'Show a loading progress bar at top of the page',
[defaultValue]: true
},
busuanzi: {
[type]: 'boolean',
[doc]: 'BuSuanZi site/page view counter\nhttps://busuanzi.ibruce.info',
[defaultValue]: false
}
};

View File

@ -1,21 +0,0 @@
const { doc, type, defaultValue } = require('../common/utils').descriptors;
module.exports = {
[type]: 'object',
[doc]: 'CDN provider settings\nhttps://ppoffice.github.io/hexo-theme-icarus/Configuration/Theme/speed-up-your-site-with-custom-cdn/',
cdn: {
[type]: 'string',
[doc]: 'Name or URL of the JavaScript and/or stylesheet CDN provider',
[defaultValue]: 'jsdelivr'
},
fontcdn: {
[type]: 'string',
[doc]: 'Name or URL of the webfont CDN provider',
[defaultValue]: 'google'
},
iconcdn: {
[type]: 'string',
[doc]: 'Name or URL of the webfont Icon CDN provider',
[defaultValue]: 'fontawesome'
}
};

View File

@ -1,17 +0,0 @@
const { doc, type, defaultValue, required, requires } = require('../common/utils').descriptors;
module.exports = {
[type]: 'object',
[doc]: 'Search plugin settings\nhttps://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Search',
type: {
[type]: 'string',
[doc]: 'Name of the search plugin',
[defaultValue]: 'insight'
},
cx: {
[type]: 'string',
[doc]: 'Google CSE cx value',
[required]: true,
[requires]: search => search.type === 'google-cse'
}
};

View File

@ -1,17 +0,0 @@
const { doc, type, defaultValue, required, requires } = require('../common/utils').descriptors;
module.exports = {
[type]: 'object',
[doc]: 'Share plugin settings\nhttps://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Share',
type: {
[type]: 'string',
[doc]: 'Share plugin name',
[defaultValue]: null
},
install_url: {
[type]: 'string',
[doc]: 'URL to the share plugin script provided by share plugin service provider',
[required]: true,
[requires]: share => share.type === 'sharethis' || share.type === 'addthis'
}
}

View File

@ -1,20 +0,0 @@
const { doc, type, defaultValue, required, requires, format } = require('../common/utils').descriptors;
function commonSettings(position) {
return {
[type]: 'object',
[doc]: position + ' sidebar settings',
sticky: {
[type]: 'boolean',
[doc]: 'Whether the ' + position + ' sidebar is sticky when page scrolls\nhttps://ppoffice.github.io/hexo-theme-icarus/Configuration/Theme/make-a-sidebar-sticky-when-page-scrolls/',
[defaultValue]: false
}
}
}
module.exports = {
[type]: 'object',
[doc]: 'Sidebar settings.\nPlease be noted that a sidebar is only visible when it has at least one widget',
left: commonSettings('left'),
right: commonSettings('right')
}

View File

@ -1,166 +0,0 @@
const { doc, type, defaultValue, required, requires, format } = require('../common/utils').descriptors;
const DEFAULT_WIDGETS = [
{
type: 'profile',
position: 'left',
author: 'Your name',
author_title: 'Your title',
location: 'Your location',
avatar: null,
gravatar: null,
avatar_rounded: false,
follow_link: 'https://github.com/ppoffice',
social_links: {
Github: {
icon: 'fab fa-github',
url: 'https://github.com/ppoffice'
},
Facebook: {
icon: 'fab fa-facebook',
url: 'https://facebook.com'
},
Twitter: {
icon: 'fab fa-twitter',
url: 'https://twitter.com'
},
Dribbble: {
icon: 'fab fa-dribbble',
url: 'https://dribbble.com'
},
RSS: {
icon: 'fas fa-rss',
url: '/'
}
}
},
{
type: 'toc',
position: 'left'
},
{
type: 'links',
position: 'left',
links: {
Hexo: 'https://hexo.io',
PPOffice: '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'
}
];
const ProfileSpec = {
author: {
[type]: 'string',
[doc]: 'Author name to be shown in the profile widget',
[defaultValue]: 'Your name'
},
author_title: {
[type]: 'string',
[doc]: 'Title of the author to be shown in the profile widget',
[defaultValue]: 'Your title'
},
location: {
[type]: 'string',
[doc]: 'Author\'s current location to be shown in the profile widget',
[defaultValue]: 'Your location'
},
avatar: {
[type]: 'string',
[doc]: 'Path or URL to the avatar to be shown in the profile widget',
[defaultValue]: '/images/avatar.png'
},
avatar_rounded: {
[type]: 'boolean',
[doc]: 'Whether to show avatar image rounded or square',
[defaultValue]: false
},
gravatar: {
[type]: 'string',
[doc]: 'Email address for the Gravatar to be shown in the profile widget',
},
follow_link: {
[type]: 'string',
[doc]: 'Path or URL for the follow button',
},
social_links: {
...require('./icon_link.spec'),
[doc]: 'Links to be shown on the bottom of the profile widget',
}
};
for (let key in ProfileSpec) {
ProfileSpec[key][requires] = widget => widget.type === 'profile';
}
const LinksSpec = {
links: {
[type]: 'object',
[doc]: 'Links to be shown in the links widget',
[requires]: parent => parent.type === 'links',
'*': {
[type]: 'string',
[doc]: 'Path or URL to the link',
[required]: true
}
}
};
const SubscrbieEmailSpec = {
feedburner_id: {
[type]: 'string',
[doc]: 'Feedburner ID',
[required]: true,
[requires]: parent => parent.type === 'subscribe_email'
},
description: {
[type]: 'string',
[doc]: 'Hint text under the subscription input',
[requires]: parent => parent.type === 'subscribe_email'
}
};
module.exports = {
[type]: 'array',
[doc]: 'Sidebar widget settings\nhttps://ppoffice.github.io/hexo-theme-icarus/categories/Widgets/',
[defaultValue]: DEFAULT_WIDGETS,
'*': {
[type]: 'object',
[doc]: 'Single widget settings',
type: {
[type]: 'string',
[doc]: 'Widget name',
[required]: true,
[defaultValue]: 'profile'
},
position: {
[type]: 'string',
[doc]: 'Where should the widget be placed, left or right',
[format]: /^(left|right)$/,
[required]: true,
[defaultValue]: 'left'
},
...ProfileSpec,
...LinksSpec,
...SubscrbieEmailSpec
}
}

View File

@ -33,14 +33,17 @@ module.exports = class extends Component {
const {
url,
meta_generator = true,
head = {},
article,
highlight
} = config;
const {
meta = [],
open_graph,
canonical_url,
rss,
favicon,
article,
highlight
} = config;
favicon
} = head;
const language = page.lang || page.language || config.language;