-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathindex.ts
More file actions
67 lines (63 loc) · 3.14 KB
/
Copy pathindex.ts
File metadata and controls
67 lines (63 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// https://vitepress.dev/guide/custom-theme
import { h, nextTick, watch } from "vue";
import type { Theme } from "vitepress";
import DefaultTheme, { VPBadge } from "vitepress/theme";
import "./style.css";
import imageViewer from "vitepress-plugin-image-viewer";
import vImageViewer from "vitepress-plugin-image-viewer/lib/vImageViewer.vue";
import { useRoute } from "vitepress";
import { createGtm } from "@gtm-support/vue-gtm";
import PageFooter from "./components/PageFooter.vue";
import MMBanner from "./components/MMBanner.vue";
import NotFound from "./NotFound.vue";
import CookieConsentView from "../components/CookieConsentView.vue";
export default {
extends: DefaultTheme,
Layout: () => {
return h(DefaultTheme.Layout, null, {
// https://vitepress.dev/guide/extending-default-theme#layout-slots
'doc-after': () => {
return [h(MMBanner), h(PageFooter)];
},
'not-found': () => {
return h(NotFound);
},
'layout-bottom': () => {
return h(CookieConsentView);
}
});
},
async enhanceApp({ app, router, siteData }) {
if (!import.meta.env.SSR) {
await import('@justinribeiro/lite-youtube')
}
DefaultTheme.enhanceApp({ app, router, siteData });
app.component("vImageViewer", vImageViewer);
app.component('VPBadge', VPBadge);
app.use(
createGtm({
id: "GTM-NW7ZGNB", // Your GTM single container ID or array of container ids ['GTM-xxxxxx', 'GTM-yyyyyy'] or array of objects [{id: 'GTM-xxxxxx', queryPararms: { gtm_auth: 'abc123', gtm_preview: 'env-4', gtm_cookies_win: 'x'}}, {id: 'GTM-yyyyyy', queryParams: {gtm_auth: 'abc234', gtm_preview: 'env-5', gtm_cookies_win: 'x'}}]
defer: false, // defaults to false. Script can be set to `defer` to increase page-load-time at the cost of less accurate results (in case visitor leaves before script is loaded, which is unlikely but possible)
enabled: false, // defaults to true. Plugin can be disabled by setting this to false for Ex: enabled: !!GDPR_Cookie (optional)
debug: false, // Whether or not display console logs debugs (optional)
loadScript: true, // Whether or not to load the GTM Script (Helpful if you are including GTM manually, but need the dataLayer functionality in your components) (optional)
vueRouter: undefined, // Pass the router instance to automatically sync with router (optional)
ignoredViews: [], // Don't trigger events for specified router names (case insensitive) (optional)
trackOnNextTick: false, // Whether or not call trackView in Vue.nextTick
})
);
// app.component("YouTube", YouTube);
const components = import.meta.glob("../components/*.vue", { eager: true });
Object.entries(components).forEach(([path, definition]) => {
// Get name of component, based on filename
// "./components/Fruits.vue" will become "Fruits"
const componentName = path?.split('/').pop()?.replace(/\.\w+$/, '')
// Register component on this Vue instance
if (componentName) app.component(componentName, definition.default)
})
},
setup: () => {
const route = useRoute();
imageViewer(route);
}
} satisfies Theme;