From 21f71cd0f2001019e95806e37a59cc19dc9f441c Mon Sep 17 00:00:00 2001 From: Jerry Date: Fri, 21 Oct 2022 18:10:52 +0800 Subject: [PATCH] =?UTF-8?q?breaking=20changes:=20Open=5FGraph=5Fmeta=20?= =?UTF-8?q?=E8=A8=AD=E7=BD=AE=E6=9B=B4=E6=94=B9=EF=BC=8C=E5=8F=AF=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=85=B6=E5=AE=83=E5=8F=83=E6=95=B8=20feature:=20?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Facebook=20sdk=20=E5=88=B0=20v15=20improve?= =?UTF-8?q?ment:=20=E6=9B=B4=E6=96=B0=20plugins.yml=20Remove:=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=20meta=20keywords?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 11 ++++++++++- layout/includes/head.pug | 7 ------- layout/includes/head/Open_Graph.pug | 18 ++++++++++-------- .../third-party/card-post-count/fb.pug | 2 +- layout/includes/third-party/chat/messenger.pug | 2 +- .../third-party/comments/facebook_comments.pug | 2 +- layout/includes/third-party/pjax.pug | 2 +- package.json | 2 +- plugins.yml | 6 +++--- source/css/_layout/third-party.styl | 7 ++----- source/js/main.js | 2 +- 11 files changed, 31 insertions(+), 30 deletions(-) diff --git a/_config.yml b/_config.yml index fa429c0..d0ba6de 100644 --- a/_config.yml +++ b/_config.yml @@ -857,7 +857,16 @@ lazyload: # Open graph meta tags # https://developers.facebook.com/docs/sharing/webmasters/ -Open_Graph_meta: true +Open_Graph_meta: + enable: true + option: + # twitter_card: + # twitter_image: + # twitter_id: + # twitter_site: + # google_plus: + # fb_admins: + # fb_app_id: # Add the vendor prefixes to ensure compatibility css_prefix: true diff --git a/layout/includes/head.pug b/layout/includes/head.pug index dcf3b74..d8ff883 100644 --- a/layout/includes/head.pug +++ b/layout/includes/head.pug @@ -7,11 +7,6 @@ - var isSubtitle = config.subtitle ? ' - ' + config.subtitle : '' - var tabTitle = is_home() || !pageTitle ? config.title + isSubtitle : pageTitle + ' | ' + config.title - -- var pageKeywords -- if (page.keywords) pageKeywords = Array.isArray(page.keywords) ? (page.keywords).join(',') : ([]).join(',') || page.keywords -- else if (page.tags && page.tags.length) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',') -- else pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords - var pageAuthor = config.email ? config.author + ',' + config.email : config.author - var pageCopyright = config.copyright || config.author - var themeColorLight = theme.theme_color && theme.theme_color.enable && theme.theme_color.meta_theme_color_light || '#ffffff' @@ -22,8 +17,6 @@ meta(charset='UTF-8') meta(http-equiv="X-UA-Compatible" content="IE=edge") meta(name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no") title= tabTitle -if pageKeywords - meta(name="keywords" content=pageKeywords) meta(name="author" content=pageAuthor) meta(name="copyright" content=pageCopyright) meta(name ="format-detection" content="telephone=no") diff --git a/layout/includes/head/Open_Graph.pug b/layout/includes/head/Open_Graph.pug index 1702985..1d04b47 100644 --- a/layout/includes/head/Open_Graph.pug +++ b/layout/includes/head/Open_Graph.pug @@ -1,11 +1,13 @@ -if theme.Open_Graph_meta - - let contentType = is_post() ? 'article' : 'website' - - let metaImage = (page.cover || theme.avatar.img) ? full_url_for(page.cover || theme.avatar.img) : '' - - let fb_appId = theme.facebook_comments.app_id || '' - - let fb_admins = theme.facebook_comments.user_id || '' - - != open_graph({type: contentType, image: metaImage, fb_admins: fb_admins, fb_app_id: fb_appId}) - +if theme.Open_Graph_meta.enable + - + let ogOption = Object.assign({ + type: is_post() ? 'article' : 'website', + image: (page.cover || theme.avatar.img) ? full_url_for(page.cover || theme.avatar.img) : '', + fb_admins: theme.facebook_comments.user_id || '', + fb_app_id: theme.facebook_comments.app_id || '', + }, theme.Open_Graph_meta.option) + - + != open_graph(ogOption) else meta(name="description" content=page_description()) diff --git a/layout/includes/third-party/card-post-count/fb.pug b/layout/includes/third-party/card-post-count/fb.pug index 67d1b85..eee1974 100644 --- a/layout/includes/third-party/card-post-count/fb.pug +++ b/layout/includes/third-party/card-post-count/fb.pug @@ -1,4 +1,4 @@ -- const fbSDKVer = 'v14.0' +- const fbSDKVer = 'v15.0' - const fbSDK = theme.messenger.enable ? `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk/xfbml.customerchat.js#xfbml=1&version=${fbSDKVer}` : `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk.js#xfbml=1&version=${fbSDKVer}` script. diff --git a/layout/includes/third-party/chat/messenger.pug b/layout/includes/third-party/chat/messenger.pug index be405dd..e7798ee 100644 --- a/layout/includes/third-party/chat/messenger.pug +++ b/layout/includes/third-party/chat/messenger.pug @@ -9,7 +9,7 @@ script. window.fbAsyncInit = function() { FB.init({ xfbml: true, - version: 'v14.0' + version: 'v15.0' }); }; diff --git a/layout/includes/third-party/comments/facebook_comments.pug b/layout/includes/third-party/comments/facebook_comments.pug index a822601..5d4d399 100644 --- a/layout/includes/third-party/comments/facebook_comments.pug +++ b/layout/includes/third-party/comments/facebook_comments.pug @@ -1,4 +1,4 @@ -- const fbSDKVer = 'v14.0' +- const fbSDKVer = 'v15.0' - const fbSDK = theme.messenger.enable ? `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk/xfbml.customerchat.js#xfbml=1&version=${fbSDKVer}` : `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk.js#xfbml=1&version=${fbSDKVer}` script. diff --git a/layout/includes/third-party/pjax.pug b/layout/includes/third-party/pjax.pug index 843d21f..3048856 100644 --- a/layout/includes/third-party/pjax.pug +++ b/layout/includes/third-party/pjax.pug @@ -7,7 +7,7 @@ if theme.pjax.exclude - let choose = theme.comments.use if choose - if theme.Open_Graph_meta && (choose.includes('Livere') || choose.includes('Utterances') || choose.includes('Giscus')) + if theme.Open_Graph_meta.enable && (choose.includes('Livere') || choose.includes('Utterances') || choose.includes('Giscus')) - pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]') if choose.includes('Utterances') || choose.includes('Giscus') - pjaxSelectors.unshift('link[rel="canonical"]') diff --git a/package.json b/package.json index 8356013..bc1c701 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "4.5.0-b3", + "version": "4.5.0", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { diff --git a/plugins.yml b/plugins.yml index f31b15c..537d9e7 100644 --- a/plugins.yml +++ b/plugins.yml @@ -5,7 +5,7 @@ algolia_search_v4: instantsearch_v4: name: instantsearch.js file: dist/instantsearch.production.min.js - version: 4.46.3 + version: 4.48.1 pjax: name: pjax file: pjax.min.js @@ -42,12 +42,12 @@ waline_js: name: '@waline/client' file: dist/waline.js other_name: waline - version: 2.11.3 + version: 2.13.0 waline_css: name: '@waline/client' file: dist/waline.css other_name: waline - version: 2.11.3 + version: 2.13.0 sharejs: name: butterfly-extsrc file: sharejs/dist/js/social-share.min.js diff --git a/source/css/_layout/third-party.styl b/source/css/_layout/third-party.styl index cf9483c..a90fa5d 100644 --- a/source/css/_layout/third-party.styl +++ b/source/css/_layout/third-party.styl @@ -25,11 +25,8 @@ --waline-theme-color: $button-bg --waline-active-color: $button-hover-color - .vuser - transition: all .5s - - &:hover - transform: rotate(360deg) + .wl-comment-actions > button:not(last-child) + padding-right: 4px if hexo-config('valine.bg') #vcomment diff --git a/source/js/main.js b/source/js/main.js index 82d9150..2e29ac8 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -477,7 +477,7 @@ document.addEventListener('DOMContentLoaded', function () { // handle some cases typeof utterancesTheme === 'function' && utterancesTheme() typeof changeGiscusTheme === 'function' && changeGiscusTheme() - typeof FB === 'object' && window.loadFBComment() + typeof FB === 'object' && window.loadFBComment && window.loadFBComment() typeof runMermaid === 'function' && window.runMermaid() }, showOrHideBtn: (e) => { // rightside 點擊設置 按鈕 展開