2021-09-30 19:26:30 +08:00
|
|
|
import fs from 'fs'
|
|
|
|
import path from 'path'
|
2022-04-09 04:32:01 +08:00
|
|
|
import { vpRoot } from '@element-plus/build-utils'
|
2021-09-30 19:26:30 +08:00
|
|
|
import { languages } from '../utils/lang'
|
2022-04-09 04:32:01 +08:00
|
|
|
|
2021-09-30 19:26:30 +08:00
|
|
|
import type { HeadConfig } from 'vitepress'
|
|
|
|
|
|
|
|
export const head: HeadConfig[] = [
|
|
|
|
[
|
|
|
|
'link',
|
|
|
|
{
|
|
|
|
rel: 'icon',
|
|
|
|
href: '/images/element-plus-logo-small.svg',
|
2022-04-10 13:56:01 +08:00
|
|
|
type: 'image/svg+xm',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'link',
|
|
|
|
{
|
|
|
|
rel: 'apple-touch-icon',
|
|
|
|
href: '/apple-touch-icon.png',
|
|
|
|
sizes: '180x180',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'link',
|
|
|
|
{
|
|
|
|
rel: 'mask-icon',
|
|
|
|
href: '/safari-pinned-tab.svg',
|
|
|
|
color: '#5bbad5',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'meta',
|
|
|
|
{
|
|
|
|
name: 'theme-color',
|
|
|
|
content: '#ffffff',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'meta',
|
|
|
|
{
|
|
|
|
name: 'msapplication-TileColor',
|
|
|
|
content: '#409eff',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'meta',
|
|
|
|
{
|
|
|
|
name: 'msapplication-config',
|
|
|
|
content: '/browserconfig.xml',
|
2021-09-30 19:26:30 +08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'script',
|
|
|
|
{},
|
|
|
|
`;(() => {
|
|
|
|
window.supportedLangs = ${JSON.stringify(languages)}
|
|
|
|
})()`,
|
|
|
|
],
|
|
|
|
|
|
|
|
['script', {}, fs.readFileSync(path.resolve(vpRoot, 'lang.js'), 'utf-8')],
|
2021-10-31 00:41:01 +08:00
|
|
|
[
|
|
|
|
'script',
|
|
|
|
{
|
|
|
|
async: 'true',
|
|
|
|
src: 'https://www.googletagmanager.com/gtag/js?id=UA-175337989-1',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'script',
|
2022-05-05 00:54:49 +08:00
|
|
|
{
|
|
|
|
async: 'true',
|
|
|
|
},
|
2021-10-31 00:41:01 +08:00
|
|
|
`window.dataLayer = window.dataLayer || [];
|
|
|
|
function gtag(){dataLayer.push(arguments);}
|
|
|
|
gtag('js', new Date());
|
|
|
|
gtag('config', 'UA-175337989-1');`,
|
|
|
|
],
|
2022-03-26 14:03:16 +08:00
|
|
|
[
|
|
|
|
'script',
|
2022-05-05 00:54:49 +08:00
|
|
|
{
|
|
|
|
async: 'true',
|
2022-05-05 10:31:23 +08:00
|
|
|
src: 'https://www.googletagmanager.com/gtag/js?id=G-M74ZHEQ1M1',
|
2022-05-05 00:54:49 +08:00
|
|
|
},
|
2022-05-05 10:31:23 +08:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'script',
|
|
|
|
{},
|
|
|
|
`
|
|
|
|
window.dataLayer = window.dataLayer || [];
|
|
|
|
function gtag(){dataLayer.push(arguments);}
|
|
|
|
gtag('js', new Date());
|
|
|
|
|
|
|
|
gtag('config', 'G-M74ZHEQ1M1');
|
|
|
|
`,
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'script',
|
|
|
|
{},
|
2022-03-26 14:03:16 +08:00
|
|
|
`(function(h,o,t,j,a,r){
|
|
|
|
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
|
|
|
|
h._hjSettings={hjid:2894908,hjsv:6};
|
|
|
|
a=o.getElementsByTagName('head')[0];
|
|
|
|
r=o.createElement('script');r.async=1;
|
|
|
|
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
|
|
|
|
a.appendChild(r);
|
|
|
|
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');`,
|
|
|
|
],
|
2022-05-05 00:54:49 +08:00
|
|
|
[
|
2021-09-30 19:26:30 +08:00
|
|
|
'script',
|
2022-05-05 00:54:49 +08:00
|
|
|
{
|
|
|
|
async: 'true',
|
|
|
|
},
|
|
|
|
`
|
|
|
|
var resource = document.createElement('link');
|
|
|
|
resource.setAttribute("rel", "stylesheet");
|
|
|
|
resource.setAttribute("href","//fonts.loli.net/css?family=Inter:300,400,500,600|Open+Sans:400,600;display=swap");
|
|
|
|
resource.setAttribute("type","text/css");
|
|
|
|
var head = document.querySelector('head');
|
|
|
|
head.appendChild(resource);
|
|
|
|
`,
|
|
|
|
],
|
|
|
|
]
|
|
|
|
|
|
|
|
head.push([
|
|
|
|
'script',
|
|
|
|
{},
|
|
|
|
fs.readFileSync(path.resolve(vpRoot, 'dark-mode.js'), 'utf-8'),
|
|
|
|
])
|