Skip to content

Commit

Permalink
chore: blog use 51 plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ATQQ committed Sep 8, 2024
1 parent d542b76 commit 5161a82
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 24 deletions.
33 changes: 9 additions & 24 deletions packages/blogpress/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import process from 'node:process'
import { getThemeConfig } from '@sugarat/theme/node'
import type { Theme } from '@sugarat/theme'
import { defineConfig } from 'vitepress'
import { La51Plugin } from 'vitepress-plugin-51la'

const baseUrl = 'https://sugarat.top'
const weekly = `${baseUrl}/weekly`
Expand Down Expand Up @@ -243,27 +243,6 @@ const blogTheme = getThemeConfig({
},
})

const extraHead: any
= process.env.NODE_ENV === 'production'
? [
[
'script',
{
charset: 'UTF-8',
id: 'LA_COLLECT',
defer: true,
// src: '//sugarat.s3.bitiful.net/npm/51la-analysis-sdk/js-sdk-pro.min.js',
src: '//sdk.51.la/js-sdk-pro.min.js'
}
],
[
'script',
{},
'document.addEventListener(\'DOMContentLoaded\', function() {typeof LA !==\'undefined\' && LA.init({id: "Jgmg5avjAUvoyePS",ck: "Jgmg5avjAUvoyePS",hashMode: true})});'
],
]
: []

export default defineConfig({
extends: blogTheme,
metaChunk: true,
Expand Down Expand Up @@ -300,13 +279,19 @@ export default defineConfig({
'link',
{ rel: 'apple-touch-icon', href: '/favicon.ico', sizes: '180x180' }
],
...extraHead
],
vite: {
server: {
port: 4000,
host: '0.0.0.0'
}
},
plugins: [
La51Plugin({
id: 'Jgmg5avjAUvoyePS',
ck: 'Jgmg5avjAUvoyePS',
importMode: 'async'
})
]
},
vue: {
template: {
Expand Down
1 change: 1 addition & 0 deletions packages/blogpress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@sugarat/theme": "workspace:*",
"element-plus": "^2.7.2",
"vitepress": "1.3.4",
"vitepress-plugin-51la": "workspace:*",
"vue": "^3.4.26"
},
"devDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5161a82

Please sign in to comment.