feat: migrate to plausible

This commit is contained in:
Arthur Fiorette 2024-01-19 00:12:05 -03:00
parent 0214ec682c
commit 9f30d5983a
No known key found for this signature in database
GPG Key ID: 6810B9EDBE06FB24

View File

@ -10,7 +10,9 @@ const VERSION = isVersion > -1 ? process.argv[isVersion + 1].slice(1, -1) : 'Lat
const BASE_URL = isVersion > -1 ? process.argv[isVersion + 1] : '/';
console.log(
isVersion > -1 ? `Building docs for version ${VERSION}` : 'Building docs for latest version'
isVersion > -1
? `Building docs for version ${VERSION}`
: 'Building docs for latest version'
);
const description =
@ -42,10 +44,22 @@ export default defineConfig({
head: [
// Attach a custom favicon
['link', { rel: 'icon', href: `${BASE_URL}favicon.ico', type: 'image/x-icon` }],
['link', { rel: 'apple-touch-icon', sizes: '57x57', href: `${BASE_URL}apple-icon-57x57.png` }],
['link', { rel: 'apple-touch-icon', sizes: '60x60', href: `${BASE_URL}apple-icon-60x60.png` }],
['link', { rel: 'apple-touch-icon', sizes: '72x72', href: `${BASE_URL}apple-icon-72x72.png` }],
['link', { rel: 'apple-touch-icon', sizes: '76x76', href: `${BASE_URL}apple-icon-76x76.png` }],
[
'link',
{ rel: 'apple-touch-icon', sizes: '57x57', href: `${BASE_URL}apple-icon-57x57.png` }
],
[
'link',
{ rel: 'apple-touch-icon', sizes: '60x60', href: `${BASE_URL}apple-icon-60x60.png` }
],
[
'link',
{ rel: 'apple-touch-icon', sizes: '72x72', href: `${BASE_URL}apple-icon-72x72.png` }
],
[
'link',
{ rel: 'apple-touch-icon', sizes: '76x76', href: `${BASE_URL}apple-icon-76x76.png` }
],
[
'link',
{
@ -125,7 +139,10 @@ export default defineConfig({
['link', { rel: 'manifest', href: `${BASE_URL}manifest.json` }],
['meta', { name: 'msapplication-TileColor', content: '#e5972a' }],
['meta', { name: 'msapplication-TileImage', content: `${BASE_URL}ms-icon-144x144.png` }],
[
'meta',
{ name: 'msapplication-TileImage', content: `${BASE_URL}ms-icon-144x144.png` }
],
['meta', { name: 'theme-color', content: '#e5972a' }],
['meta', { name: 'description', content: description }],
@ -144,9 +161,6 @@ export default defineConfig({
['meta', { name: 'twitter:description', content: description }],
['meta', { name: 'twitter:image', content: `${BASE_URL}preview.png` }],
// Analytics :(
// This is an open source documentation project, analytics is being used to only track the number of visitors.
// I won't get mad if you disable it.
[
'meta',
{
@ -154,13 +168,17 @@ export default defineConfig({
content: 'u9Nw6WpRrWDhdPTAv-LGIE9aJ0C15t7zkjuaUizDJnA'
}
],
['script', { async: 'true', src: 'https://www.googletagmanager.com/gtag/js?id=G-K548ZF395X' }],
// Analytics (Plausible) public available at https://plausible.io/axios-cache-interceptor.js.org
[
'script',
{},
`function gtag() { dataLayer.push(arguments); }; (window.dataLayer = window.dataLayer || []); gtag('js', new Date()); gtag('config', 'G-K548ZF395X');`
{
defer: '',
'data-domain': 'axios-cache-interceptor.js.org',
src: 'https://plausible.io/js/script.js'
}
],
// Ld+Json
[
'script',
@ -216,13 +234,16 @@ export default defineConfig({
items: [
{ text: 'Latest', link: url },
{ text: 'v0.x', link: `${url}/v0/` }
].filter((i) => (BASE_URL === '/' ? i.text !== 'Latest' : !i.link.includes(BASE_URL)))
].filter((i) =>
BASE_URL === '/' ? i.text !== 'Latest' : !i.link.includes(BASE_URL)
)
}
],
//! Temp link for testing, will be changed to the real one before merged to production
editLink: {
pattern: 'https://github.com/arthurfiorette/axios-cache-interceptor/edit/main/docs/src/:path'
pattern:
'https://github.com/arthurfiorette/axios-cache-interceptor/edit/main/docs/src/:path'
},
footer: {