Hanye官网
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

content.config.ts 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. body: z.object({
  41. value: z.string(),
  42. }),
  43. }),
  44. });
  45. // 定义 Usage 集合
  46. const usageCollection = defineCollection({
  47. type: "page",
  48. schema: z.object({
  49. title: z.string(),
  50. description: z.string(),
  51. id: z.string(),
  52. category: z.string(),
  53. products: z.array(z.string()),
  54. summary: z.string(),
  55. sort: z.number(),
  56. }),
  57. });
  58. // 定义 FAQ 集合
  59. const faqCollection = defineCollection({
  60. type: "page",
  61. schema: z.object({
  62. title: z.string(),
  63. description: z.string().optional(),
  64. id: z.string(),
  65. category: z.string(),
  66. question: z.string(),
  67. answer: z.string(),
  68. sort: z.number(),
  69. }),
  70. });
  71. // 定义默认集合
  72. const defaultCollection = defineCollection({
  73. type: "page",
  74. });
  75. export default {
  76. categories: categoryCollection,
  77. products: productCollection,
  78. usages: usageCollection,
  79. faq: faqCollection,
  80. content: defaultCollection,
  81. };