Hanye官网
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. model: z.string(),
  27. description: z.string().optional(),
  28. id: z.string(),
  29. categoryId: z.string(), // 关联类别的ID
  30. usage: z.array(z.string()),
  31. series: z.array(z.string()),
  32. tag: z.array(z.string()),
  33. image: z.string(),
  34. gallery: z.array(z.string()),
  35. summary: z.string(),
  36. capacities: z.array(z.string()),
  37. sort: z.number(),
  38. recommend: z.boolean(),
  39. recommendIndex: z.number(),
  40. sn: z.string(),
  41. body: z.object({
  42. value: z.string(),
  43. }),
  44. }),
  45. });
  46. // 定义 Usage 集合
  47. const usageCollection = defineCollection({
  48. type: "page",
  49. schema: z.object({
  50. title: z.string(),
  51. description: z.string(),
  52. id: z.string(),
  53. category: z.string(),
  54. products: z.array(z.string()),
  55. summary: z.string(),
  56. sort: z.number(),
  57. }),
  58. });
  59. // 定义 FAQ 集合
  60. const faqCollection = defineCollection({
  61. type: "page",
  62. schema: z.object({
  63. title: z.string(),
  64. description: z.string().optional(),
  65. id: z.string(),
  66. category: z.string(),
  67. question: z.string(),
  68. answer: z.string(),
  69. sort: z.number(),
  70. }),
  71. });
  72. // 定义默认集合
  73. const defaultCollection = defineCollection({
  74. type: "page",
  75. });
  76. export default {
  77. categories: categoryCollection,
  78. products: productCollection,
  79. usages: usageCollection,
  80. faq: faqCollection,
  81. content: defaultCollection,
  82. };