Skip to content

Commit

Permalink
Fix SEO
Browse files Browse the repository at this point in the history
  • Loading branch information
tangly1024 committed Nov 18, 2023
1 parent 6089253 commit 7f8bf75
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
22 changes: 12 additions & 10 deletions components/QrCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ export default function QrCode({ value }) {
return
}
loadExternalResource(qrCodeCDN, 'js').then(url => {
const QRCode = window.QRCode
qrcode = new QRCode(document.getElementById('qrcode'), {
text: value,
width: 256,
height: 256,
colorDark: '#000000',
colorLight: '#ffffff',
correctLevel: QRCode.CorrectLevel.H
})
// console.log('二维码', qrcode, value)
const QRCode = window?.QRCode
if (typeof QRCode !== 'undefined') {
qrcode = new QRCode(document.getElementById('qrcode'), {
text: value,
width: 256,
height: 256,
colorDark: '#000000',
colorLight: '#ffffff',
correctLevel: QRCode.CorrectLevel.H
})
// console.log('二维码', qrcode, value)
}
})
return () => {
if (qrcode) {
Expand Down
17 changes: 10 additions & 7 deletions components/Twikoo.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ const Twikoo = ({ isDarkMode }) => {

const lang = siteConfig('LANG')
useEffect(() => {
window?.twikoo?.init({
envId: envId, // 腾讯云环境填 envId;Vercel 环境填地址(https://xxx.vercel.app)
el: el, // 容器元素
lang: lang // 用于手动设定评论区语言,支持的语言列表 https://github.com/imaegoo/twikoo/blob/main/src/client/utils/i18n/index.js
// region: 'ap-guangzhou', // 环境地域,默认为 ap-shanghai,腾讯云环境填 ap-shanghai 或 ap-guangzhou;Vercel 环境不填
// path: location.pathname, // 用于区分不同文章的自定义 js 路径,如果您的文章路径不是 location.pathname,需传此参数
})
const twikoo = window?.twikoo
if (typeof twikoo !== 'undefined' && twikoo) {
twikoo.init({
envId: envId, // 腾讯云环境填 envId;Vercel 环境填地址(https://xxx.vercel.app)
el: el, // 容器元素
lang: lang // 用于手动设定评论区语言,支持的语言列表 https://github.com/imaegoo/twikoo/blob/main/src/client/utils/i18n/index.js
// region: 'ap-guangzhou', // 环境地域,默认为 ap-shanghai,腾讯云环境填 ap-shanghai 或 ap-guangzhou;Vercel 环境不填
// path: location.pathname, // 用于区分不同文章的自定义 js 路径,如果您的文章路径不是 location.pathname,需传此参数
})
}
}, [isDarkMode])
return (
<div id="twikoo"></div>
Expand Down

0 comments on commit 7f8bf75

Please sign in to comment.