valaxy 0.20.0 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  // TODO: add docs to override ValaxyApp
3
3
  import { computed } from 'vue'
4
- import { useHead, useSeoMeta } from '@unhead/vue'
4
+ // import { useHead, useSeoMeta } from '@unhead/vue'
5
+ import { useSeoMeta } from '@unhead/vue'
5
6
 
6
7
  // @ts-expect-error virtual module
7
8
  import ValaxyUserApp from '/@valaxyjs/UserAppVue'
8
9
  // @ts-expect-error virtual module
9
10
  import ValaxyThemeApp from '/@valaxyjs/ThemeAppVue'
10
11
 
11
- import pkg from 'valaxy/package.json'
12
12
  import { useI18n } from 'vue-i18n'
13
13
  import { definePerson, defineWebPage, defineWebSite, useSchemaOrg } from '@unhead/schema-org'
14
14
 
@@ -16,7 +16,7 @@ import { definePerson, defineWebPage, defineWebSite, useSchemaOrg } from '@unhea
16
16
  // you can use this to manipulate the document head in any components,
17
17
  // they will be rendered correctly in the html results with vite-ssg
18
18
  import { useSiteConfig } from '../config'
19
- import { useFrontmatter } from '../composables'
19
+ import { useFrontmatter, useValaxyHead } from '../composables'
20
20
  import { useTimezone } from '../composables/global'
21
21
  import ValaxyAddons from './ValaxyAddons.vue'
22
22
 
@@ -30,38 +30,6 @@ const fm = useFrontmatter()
30
30
  const { locale } = useI18n()
31
31
 
32
32
  const title = computed(() => fm.value[`title_${locale.value}`] || fm.value.title)
33
- useHead({
34
- title,
35
- titleTemplate: computed(() => fm.value.titleTemplate || ((title: string) => title ? `${title} - ${siteConfig.value.title}` : siteConfig.value.title)),
36
- link: [
37
- {
38
- rel: 'icon',
39
- href: siteConfig.value.favicon,
40
- type: siteConfig.value.favicon?.endsWith('svg') ? 'image/svg+xml' : 'image/png',
41
- },
42
- ],
43
- meta: [
44
- { name: 'description', content: computed(() => siteConfig.value.description) },
45
- {
46
- name: 'generator',
47
- content: `Valaxy ${pkg.version}`,
48
- },
49
- ],
50
-
51
- templateParams: {
52
- schemaOrg: {
53
- host: siteConfig.value.url,
54
- },
55
- },
56
-
57
- script: [
58
- {
59
- id: 'check-mac-os',
60
- innerHTML: `document.documentElement.classList.toggle('mac', /Mac|iPhone|iPod|iPad/i.test(navigator.platform))`,
61
- async: true,
62
- },
63
- ],
64
- })
65
33
 
66
34
  // seo
67
35
  // todo: get first image url from markdown
@@ -99,6 +67,8 @@ useSchemaOrg([
99
67
  ])
100
68
 
101
69
  useTimezone()
70
+
71
+ useValaxyHead()
102
72
  </script>
103
73
 
104
74
  <template>
@@ -0,0 +1 @@
1
+ export * from './useValaxyHead'
@@ -0,0 +1,47 @@
1
+ import { computed } from 'vue'
2
+ import pkg from 'valaxy/package.json'
3
+ import { useHead } from '@unhead/vue'
4
+ import { useI18n } from 'vue-i18n'
5
+
6
+ import { useSiteConfig } from '../../config'
7
+ import { useFrontmatter } from '../../composables'
8
+
9
+ export function useValaxyHead() {
10
+ const { locale } = useI18n()
11
+
12
+ const fm = useFrontmatter()
13
+ const siteConfig = useSiteConfig()
14
+ const title = computed(() => fm.value[`title_${locale.value}`] || fm.value.title)
15
+ useHead({
16
+ title,
17
+ titleTemplate: computed(() => fm.value.titleTemplate || ((title: string) => title ? `${title} - ${siteConfig.value.title}` : siteConfig.value.title)),
18
+ link: [
19
+ {
20
+ rel: 'icon',
21
+ href: siteConfig.value.favicon,
22
+ type: siteConfig.value.favicon?.endsWith('svg') ? 'image/svg+xml' : 'image/png',
23
+ },
24
+ ],
25
+ meta: [
26
+ { name: 'description', content: computed(() => siteConfig.value.description) },
27
+ {
28
+ name: 'generator',
29
+ content: `Valaxy ${pkg.version}`,
30
+ },
31
+ ],
32
+
33
+ templateParams: {
34
+ schemaOrg: {
35
+ host: siteConfig.value.url,
36
+ },
37
+ },
38
+
39
+ script: [
40
+ {
41
+ id: 'check-mac-os',
42
+ innerHTML: `document.documentElement.classList.toggle('mac', /Mac|iPhone|iPod|iPad/i.test(navigator.platform))`,
43
+ async: true,
44
+ },
45
+ ],
46
+ })
47
+ }
@@ -19,3 +19,6 @@ export * from './outline'
19
19
  // utils
20
20
  export * from './back'
21
21
  export * from './decrypt'
22
+
23
+ // app
24
+ export * from './app'