valaxy 0.11.2 → 0.11.4

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.
package/client/App.vue CHANGED
@@ -1,12 +1,13 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, provide, ref } from 'vue'
3
- import { useHead } from '@vueuse/head'
3
+ import { useHead, useSeoMeta } from '@vueuse/head'
4
4
  // @ts-expect-error virtual module
5
5
  import ValaxyUserApp from '/@valaxyjs/UserAppVue'
6
6
  // @ts-expect-error virtual module
7
7
  import ValaxyThemeApp from '/@valaxyjs/ThemeAppVue'
8
+ import pkg from 'valaxy/package.json'
8
9
  import ValaxyAddons from './components/ValaxyAddons.vue'
9
- import { isDark } from './composables'
10
+ import { isDark, useFrontmatter } from './composables'
10
11
 
11
12
  // https://github.com/vueuse/head
12
13
  // you can use this to manipulate the document head in any components,
@@ -28,7 +29,7 @@ useHead({
28
29
  },
29
30
  ],
30
31
  meta: [
31
- { name: 'description', content: config.value.description },
32
+ { name: 'description', content: computed(() => config.value.description) },
32
33
  {
33
34
  name: 'theme-color',
34
35
  content: themeColor,
@@ -37,9 +38,26 @@ useHead({
37
38
  name: 'msapplication-TileColor',
38
39
  content: themeColor,
39
40
  },
41
+ {
42
+ name: 'generator',
43
+ content: `Valaxy ${pkg.version}`,
44
+ },
40
45
  ],
41
46
  })
42
47
 
48
+ // seo
49
+ // todo: get first image url from markdown
50
+ const fm = useFrontmatter()
51
+ useSeoMeta({
52
+ description: computed(() => fm.value.excerpt || config.value.description),
53
+ ogDescription: computed(() => fm.value.excerpt || config.value.description),
54
+ ogLocale: computed(() => fm.value.lang || config.value.lang),
55
+ ogSiteName: computed(() => config.value.title),
56
+ ogTitle: computed(() => fm.value.title || config.value.title),
57
+ ogImage: computed(() => config.value.favicon),
58
+ ogUrl: computed(() => fm.value.url || config.value.url),
59
+ })
60
+
43
61
  const onContentUpdated = ref()
44
62
  provide('onContentUpdated', onContentUpdated)
45
63
  </script>
package/client/config.ts CHANGED
@@ -15,7 +15,7 @@ import type { DefaultThemeConfig, SiteConfig as ValaxySiteConfig } from 'valaxy/
15
15
  * @param data
16
16
  * @returns
17
17
  */
18
- function parse<T=any>(data: string): T {
18
+ function parse<T = any>(data: string): T {
19
19
  const parsed = JSON.parse(data)
20
20
  return (__DEV__ ? readonly(parsed) : parsed) as T
21
21
  }