Skip to content

Commit

Permalink
chore: resolve code conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
WRXinYue committed Oct 31, 2024
1 parent 5018805 commit 12372aa
Show file tree
Hide file tree
Showing 6 changed files with 1,058 additions and 959 deletions.
40 changes: 5 additions & 35 deletions packages/valaxy/client/components/ValaxyApp.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<script setup lang="ts">
// TODO: add docs to override ValaxyApp
import { computed } from 'vue'
import { useHead, useSeoMeta } from '@unhead/vue'
// import { useHead, useSeoMeta } from '@unhead/vue'
import { useSeoMeta } from '@unhead/vue'
// @ts-expect-error virtual module
import ValaxyUserApp from '/@valaxyjs/UserAppVue'
// @ts-expect-error virtual module
import ValaxyThemeApp from '/@valaxyjs/ThemeAppVue'
import pkg from 'valaxy/package.json'
import { useI18n } from 'vue-i18n'
import { definePerson, defineWebPage, defineWebSite, useSchemaOrg } from '@unhead/schema-org'
// https://github.com/vueuse/head
// you can use this to manipulate the document head in any components,
// they will be rendered correctly in the html results with vite-ssg
import { useSiteConfig } from '../config'
import { useFrontmatter } from '../composables'
import { useFrontmatter, useValaxyHead } from '../composables'
import { useTimezone } from '../composables/global'
import ValaxyAddons from './ValaxyAddons.vue'
Expand All @@ -30,38 +30,6 @@ const fm = useFrontmatter()
const { locale } = useI18n()
const title = computed(() => fm.value[`title_${locale.value}`] || fm.value.title)
useHead({
title,
titleTemplate: computed(() => fm.value.titleTemplate || ((title: string) => title ? `${title} - ${siteConfig.value.title}` : siteConfig.value.title)),
link: [
{
rel: 'icon',
href: siteConfig.value.favicon,
type: siteConfig.value.favicon?.endsWith('svg') ? 'image/svg+xml' : 'image/png',
},
],
meta: [
{ name: 'description', content: computed(() => siteConfig.value.description) },
{
name: 'generator',
content: `Valaxy ${pkg.version}`,
},
],
templateParams: {
schemaOrg: {
host: siteConfig.value.url,
},
},
script: [
{
id: 'check-mac-os',
innerHTML: `document.documentElement.classList.toggle('mac', /Mac|iPhone|iPod|iPad/i.test(navigator.platform))`,
async: true,
},
],
})
// seo
// todo: get first image url from markdown
Expand Down Expand Up @@ -99,6 +67,8 @@ useSchemaOrg([
])
useTimezone()
useValaxyHead()
</script>

<template>
Expand Down
1 change: 1 addition & 0 deletions packages/valaxy/client/composables/app/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './useValaxyHead'
47 changes: 47 additions & 0 deletions packages/valaxy/client/composables/app/useValaxyHead.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { computed } from 'vue'
import pkg from 'valaxy/package.json'
import { useHead } from '@unhead/vue'
import { useI18n } from 'vue-i18n'

import { useSiteConfig } from '../../config'
import { useFrontmatter } from '../../composables'

export function useValaxyHead() {
const { locale } = useI18n()

const fm = useFrontmatter()
const siteConfig = useSiteConfig()
const title = computed(() => fm.value[`title_${locale.value}`] || fm.value.title)
useHead({
title,
titleTemplate: computed(() => fm.value.titleTemplate || ((title: string) => title ? `${title} - ${siteConfig.value.title}` : siteConfig.value.title)),
link: [
{
rel: 'icon',
href: siteConfig.value.favicon,
type: siteConfig.value.favicon?.endsWith('svg') ? 'image/svg+xml' : 'image/png',
},
],
meta: [
{ name: 'description', content: computed(() => siteConfig.value.description) },
{
name: 'generator',
content: `Valaxy ${pkg.version}`,
},
],

templateParams: {
schemaOrg: {
host: siteConfig.value.url,
},
},

script: [
{
id: 'check-mac-os',
innerHTML: `document.documentElement.classList.toggle('mac', /Mac|iPhone|iPod|iPad/i.test(navigator.platform))`,
async: true,
},
],
})
}
3 changes: 3 additions & 0 deletions packages/valaxy/client/composables/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ export * from './outline'
export * from './back'
export * from './decrypt'
export * from './search'

// app
export * from './app'
7 changes: 3 additions & 4 deletions packages/valaxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
"pathe": "^1.1.2",
"pinia": "^2.2.5",
"qrcode": "^1.5.4",
"resolve": "^1.22.8",
"resolve-global": "^2.0.0",
"sass": "^1.80.5",
"shiki": "^1.22.2",
Expand All @@ -132,9 +131,9 @@
"vanilla-lazyload": "^19.1.3",
"vite": "^5.4.10",
"vite-plugin-vue-devtools": "^7.5.6",
"vite-plugin-vue-layouts": "0.11.0",
"vite-ssg": "0.23.7",
"vite-ssg-sitemap": "0.6.1",
"vite-plugin-vue-layouts": "^0.11.0",
"vite-ssg": "^0.24.0",
"vite-ssg-sitemap": "^0.8.1",
"vue": "^3.5.12",
"vue-i18n": "^10.0.4",
"vue-router": "^4.4.5",
Expand Down
Loading

0 comments on commit 12372aa

Please sign in to comment.