mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-10 21:17:07 +08:00
Fix merge conflicts
This commit is contained in:
@@ -1033,7 +1033,11 @@ Open_Graph_meta:
|
|||||||
|
|
||||||
# Structured Data
|
# Structured Data
|
||||||
# https://developers.google.com/search/docs/guides/intro-structured-data
|
# https://developers.google.com/search/docs/guides/intro-structured-data
|
||||||
structured_data: false
|
structured_data:
|
||||||
|
enable: false
|
||||||
|
# Alternate name for the site, used in structured data
|
||||||
|
# Format: ['name1', 'name2']
|
||||||
|
alternate_name:
|
||||||
|
|
||||||
# Add the vendor prefixes to ensure compatibility
|
# Add the vendor prefixes to ensure compatibility
|
||||||
css_prefix: true
|
css_prefix: true
|
||||||
|
|||||||
@@ -40,10 +40,22 @@ if theme.structured_data
|
|||||||
const isRootOrSubdomain = currentPath.split('/').filter(Boolean).length === 0;
|
const isRootOrSubdomain = currentPath.split('/').filter(Boolean).length === 0;
|
||||||
|
|
||||||
if (isRootOrSubdomain) {
|
if (isRootOrSubdomain) {
|
||||||
|
const domain = new URL(config.url).hostname;
|
||||||
|
const alternateNames = theme.structured_data.alternate_name || [];
|
||||||
|
|
||||||
|
if (config.subtitle) {
|
||||||
|
alternateNames.push(config.subtitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (domain) {
|
||||||
|
alternateNames.push(domain);
|
||||||
|
}
|
||||||
|
|
||||||
const jsonLd = {
|
const jsonLd = {
|
||||||
"@context": "https://schema.org",
|
"@context": "https://schema.org",
|
||||||
"@type": "WebSite",
|
"@type": "WebSite",
|
||||||
"name": config.title,
|
"name": config.title,
|
||||||
|
"alternateName": alternateNames,
|
||||||
"url": full_url_for('/'),
|
"url": full_url_for('/'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -574,7 +574,10 @@ module.exports = {
|
|||||||
enable: true,
|
enable: true,
|
||||||
option: null
|
option: null
|
||||||
},
|
},
|
||||||
structured_data: false,
|
structured_data: {
|
||||||
|
enable: false,
|
||||||
|
alternate_name: null
|
||||||
|
},
|
||||||
css_prefix: true,
|
css_prefix: true,
|
||||||
inject: {
|
inject: {
|
||||||
head: null,
|
head: null,
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ hexo.extend.helper.register('urlNoIndex', function (url = null, trailingIndex =
|
|||||||
})
|
})
|
||||||
|
|
||||||
hexo.extend.helper.register('md5', function (path) {
|
hexo.extend.helper.register('md5', function (path) {
|
||||||
return crypto.createHash('md5').update(decodeURI(this.url_for(path))).digest('hex')
|
return crypto.createHash('md5').update(decodeURI(this.url_for(path, {relative: false}))).digest('hex')
|
||||||
})
|
})
|
||||||
|
|
||||||
hexo.extend.helper.register('injectHtml', data => {
|
hexo.extend.helper.register('injectHtml', data => {
|
||||||
|
|||||||
Reference in New Issue
Block a user