valaxy-theme-yun 0.15.12 → 0.15.13

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.
Files changed (2) hide show
  1. package/layouts/post.vue +21 -11
  2. package/package.json +2 -2
package/layouts/post.vue CHANGED
@@ -2,7 +2,9 @@
2
2
  import { computed } from 'vue'
3
3
  import { useFrontmatter, useFullUrl, useSiteConfig } from 'valaxy'
4
4
 
5
+ import type { Article } from '@unhead/schema-org'
5
6
  import { defineArticle, useSchemaOrg } from '@unhead/schema-org'
7
+ import dayjs from 'dayjs'
6
8
 
7
9
  const siteConfig = useSiteConfig()
8
10
  const frontmatter = useFrontmatter()
@@ -15,18 +17,26 @@ const showSponsor = computed(() => {
15
17
  return siteConfig.value.sponsor.enable
16
18
  })
17
19
 
20
+ const article: Article = {
21
+ '@type': 'BlogPosting',
22
+ 'headline': frontmatter.value.title,
23
+ 'description': frontmatter.value.description,
24
+ 'author': [
25
+ {
26
+ name: siteConfig.value.author.name,
27
+ url: siteConfig.value.author.link,
28
+ },
29
+ ],
30
+ 'datePublished': dayjs(frontmatter.value.date).toDate(),
31
+ 'dateModified': dayjs(frontmatter.value.updated).toDate(),
32
+ }
33
+
34
+ const image = frontmatter.value.image || frontmatter.value.cover
35
+ if (image)
36
+ article.image = image
37
+
18
38
  useSchemaOrg(
19
- defineArticle({
20
- '@type': 'BlogPosting',
21
- 'headline': frontmatter.value.title,
22
- 'description': frontmatter.value.description,
23
- 'author': [
24
- {
25
- name: siteConfig.value.author.name,
26
- url: siteConfig.value.author.link,
27
- },
28
- ],
29
- }),
39
+ defineArticle(article),
30
40
  )
31
41
  </script>
32
42
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy-theme-yun",
3
- "version": "0.15.12",
3
+ "version": "0.15.13",
4
4
  "author": {
5
5
  "email": "me@yunyoujun.cn",
6
6
  "name": "YunYouJun",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/animejs": "^3.1.10",
27
- "valaxy": "0.15.12",
27
+ "valaxy": "0.15.13",
28
28
  "valaxy-addon-waline": "0.1.1"
29
29
  }
30
30
  }