Hanye官网
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

content.config.ts 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import { defineCollection, z } from '@nuxt/content'
  2. // 定义 Category 集合
  3. const categoryCollection = defineCollection({
  4. type: 'page',
  5. schema: z.object({
  6. title: z.string(),
  7. description: z.string().optional(),
  8. id: z.string(),
  9. image: z.string(),
  10. summary: z.string(),
  11. capacities: z.array(z.string()),
  12. sort: z.number(),
  13. tags: z.array(z.string()),
  14. audiences: z.array(z.string()),
  15. body: z.object({
  16. value: z.string()
  17. })
  18. })
  19. })
  20. // 定义 Product 集合
  21. const productCollection = defineCollection({
  22. type: 'page',
  23. schema: z.object({
  24. title: z.string(),
  25. name: z.string(),
  26. description: z.string().optional(),
  27. id: z.string(),
  28. categoryId: z.string(), // 关联类别的ID
  29. usage: z.array(z.string()),
  30. series: z.array(z.string()),
  31. tag: z.array(z.string()),
  32. image: z.string(),
  33. gallery: z.array(z.string()),
  34. summary: z.string(),
  35. capacities: z.array(z.string()),
  36. sort: z.number(),
  37. body: z.object({
  38. value: z.string()
  39. })
  40. })
  41. })
  42. // 定义 Usage 集合
  43. const usageCollection = defineCollection({
  44. type: 'page',
  45. schema: z.object({
  46. title: z.string(),
  47. description: z.string(),
  48. id: z.string(),
  49. category: z.string(),
  50. products: z.array(z.string()),
  51. summary: z.string(),
  52. sort: z.number()
  53. })
  54. })
  55. // 定义 FAQ 集合
  56. const faqCollection = defineCollection({
  57. type: 'page',
  58. schema: z.object({
  59. title: z.string(),
  60. description: z.string().optional(),
  61. id: z.string(),
  62. category: z.string(),
  63. question: z.string(),
  64. answer: z.string(),
  65. sort: z.number()
  66. })
  67. })
  68. // 定义默认集合
  69. const defaultCollection = defineCollection({
  70. type: 'page'
  71. })
  72. export default {
  73. categories: categoryCollection,
  74. products: productCollection,
  75. usages: usageCollection,
  76. faq: faqCollection,
  77. content: defaultCollection
  78. }