create-shapio 0.2.0

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 (161) hide show
  1. package/LICENSE +201 -0
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +311 -0
  4. package/dist/index.js.map +1 -0
  5. package/package.json +37 -0
  6. package/templates/astro/.env.example +10 -0
  7. package/templates/astro/README.md +31 -0
  8. package/templates/astro/astro.config.mjs +50 -0
  9. package/templates/astro/gitignore +4 -0
  10. package/templates/astro/package.json +31 -0
  11. package/templates/astro/public/favicon.svg +9 -0
  12. package/templates/astro/public/robots.txt +3 -0
  13. package/templates/astro/scripts/incrementalBuild.ts +142 -0
  14. package/templates/astro/scripts/lib/admin.ts +76 -0
  15. package/templates/astro/scripts/lib/callback.ts +46 -0
  16. package/templates/astro/scripts/lib/content.ts +462 -0
  17. package/templates/astro/scripts/lib/png.ts +47 -0
  18. package/templates/astro/scripts/reportStatus.ts +40 -0
  19. package/templates/astro/scripts/seed.ts +396 -0
  20. package/templates/astro/scripts/smoke.ts +127 -0
  21. package/templates/astro/scripts/smokeHttp.ts +162 -0
  22. package/templates/astro/shapio/components/callToAction.json +85 -0
  23. package/templates/astro/shapio/components/feature.json +46 -0
  24. package/templates/astro/shapio/components/featureGrid.json +51 -0
  25. package/templates/astro/shapio/components/gallery.json +52 -0
  26. package/templates/astro/shapio/components/hero.json +108 -0
  27. package/templates/astro/shapio/models/article.json +150 -0
  28. package/templates/astro/shapio/models/author.json +73 -0
  29. package/templates/astro/shapio/models/page.json +93 -0
  30. package/templates/astro/shapio/models/siteSettings.json +87 -0
  31. package/templates/astro/src/layouts/Base.astro +52 -0
  32. package/templates/astro/src/lib/config.ts +42 -0
  33. package/templates/astro/src/lib/preview.ts +57 -0
  34. package/templates/astro/src/lib/render.ts +146 -0
  35. package/templates/astro/src/lib/shapio.ts +104 -0
  36. package/templates/astro/src/lib/site.ts +55 -0
  37. package/templates/astro/src/lib/types.ts +96 -0
  38. package/templates/astro/src/pages/404.astro +8 -0
  39. package/templates/astro/src/pages/[locale]/[...slug].astro +28 -0
  40. package/templates/astro/src/pages/[locale]/articles/[slug].astro +25 -0
  41. package/templates/astro/src/pages/[locale]/articles/index.astro +22 -0
  42. package/templates/astro/src/pages/[locale]/colophon.astro +19 -0
  43. package/templates/astro/src/pages/build.json.ts +9 -0
  44. package/templates/astro/src/pages/index.astro +18 -0
  45. package/templates/astro/src/pages/preview.astro +21 -0
  46. package/templates/astro/src/scripts/preview.ts +47 -0
  47. package/templates/astro/src/styles/site.css +199 -0
  48. package/templates/astro/tsconfig.json +17 -0
  49. package/templates/next/.env.example +15 -0
  50. package/templates/next/README.md +69 -0
  51. package/templates/next/gitignore +5 -0
  52. package/templates/next/next.config.ts +69 -0
  53. package/templates/next/package.json +34 -0
  54. package/templates/next/public/favicon.svg +9 -0
  55. package/templates/next/scripts/lib/admin.ts +76 -0
  56. package/templates/next/scripts/lib/content.ts +462 -0
  57. package/templates/next/scripts/lib/png.ts +47 -0
  58. package/templates/next/scripts/seed.ts +396 -0
  59. package/templates/next/scripts/smokeHttp.ts +162 -0
  60. package/templates/next/shapio/components/callToAction.json +85 -0
  61. package/templates/next/shapio/components/feature.json +46 -0
  62. package/templates/next/shapio/components/featureGrid.json +51 -0
  63. package/templates/next/shapio/components/gallery.json +52 -0
  64. package/templates/next/shapio/components/hero.json +108 -0
  65. package/templates/next/shapio/models/article.json +150 -0
  66. package/templates/next/shapio/models/author.json +73 -0
  67. package/templates/next/shapio/models/page.json +93 -0
  68. package/templates/next/shapio/models/siteSettings.json +87 -0
  69. package/templates/next/src/app/[locale]/[[...slug]]/page.tsx +40 -0
  70. package/templates/next/src/app/[locale]/articles/[slug]/page.tsx +37 -0
  71. package/templates/next/src/app/[locale]/articles/page.tsx +28 -0
  72. package/templates/next/src/app/[locale]/colophon/page.tsx +25 -0
  73. package/templates/next/src/app/[locale]/layout.tsx +77 -0
  74. package/templates/next/src/app/api/revalidate/route.ts +31 -0
  75. package/templates/next/src/app/preview/layout.tsx +20 -0
  76. package/templates/next/src/app/preview/page.tsx +6 -0
  77. package/templates/next/src/app/site.css +199 -0
  78. package/templates/next/src/components/ArticleCard/index.tsx +19 -0
  79. package/templates/next/src/components/ArticleView/index.tsx +40 -0
  80. package/templates/next/src/components/Byline/index.tsx +15 -0
  81. package/templates/next/src/components/LocaleSwitch/index.tsx +16 -0
  82. package/templates/next/src/components/Preview/hooks/usePreviewDraft.ts +53 -0
  83. package/templates/next/src/components/Preview/index.tsx +33 -0
  84. package/templates/next/src/components/ResponsiveImage/index.tsx +36 -0
  85. package/templates/next/src/components/RichText/index.tsx +13 -0
  86. package/templates/next/src/components/Sections/CallToAction/index.tsx +14 -0
  87. package/templates/next/src/components/Sections/FeatureGrid/index.tsx +17 -0
  88. package/templates/next/src/components/Sections/Gallery/index.tsx +20 -0
  89. package/templates/next/src/components/Sections/Hero/index.tsx +31 -0
  90. package/templates/next/src/components/Sections/SectionView/index.tsx +30 -0
  91. package/templates/next/src/components/Sections/index.tsx +19 -0
  92. package/templates/next/src/lib/articles.ts +5 -0
  93. package/templates/next/src/lib/config.ts +57 -0
  94. package/templates/next/src/lib/liveSnapshot.ts +74 -0
  95. package/templates/next/src/lib/log.ts +4 -0
  96. package/templates/next/src/lib/preview.ts +56 -0
  97. package/templates/next/src/lib/revalidation.ts +91 -0
  98. package/templates/next/src/lib/revalidationTargets.test.ts +67 -0
  99. package/templates/next/src/lib/revalidationTargets.ts +66 -0
  100. package/templates/next/src/lib/shapio.ts +75 -0
  101. package/templates/next/src/lib/site.ts +66 -0
  102. package/templates/next/src/lib/types.ts +96 -0
  103. package/templates/next/src/lib/webhookEvent.test.ts +61 -0
  104. package/templates/next/src/lib/webhookEvent.ts +47 -0
  105. package/templates/next/src/styles.d.ts +3 -0
  106. package/templates/next/tsconfig.json +23 -0
  107. package/templates/sveltekit/.env.example +10 -0
  108. package/templates/sveltekit/README.md +38 -0
  109. package/templates/sveltekit/gitignore +4 -0
  110. package/templates/sveltekit/package.json +38 -0
  111. package/templates/sveltekit/scripts/lib/admin.ts +76 -0
  112. package/templates/sveltekit/scripts/lib/content.ts +462 -0
  113. package/templates/sveltekit/scripts/lib/png.ts +47 -0
  114. package/templates/sveltekit/scripts/seed.ts +396 -0
  115. package/templates/sveltekit/scripts/smokeHttp.ts +162 -0
  116. package/templates/sveltekit/shapio/components/callToAction.json +85 -0
  117. package/templates/sveltekit/shapio/components/feature.json +46 -0
  118. package/templates/sveltekit/shapio/components/featureGrid.json +51 -0
  119. package/templates/sveltekit/shapio/components/gallery.json +52 -0
  120. package/templates/sveltekit/shapio/components/hero.json +108 -0
  121. package/templates/sveltekit/shapio/models/article.json +150 -0
  122. package/templates/sveltekit/shapio/models/author.json +73 -0
  123. package/templates/sveltekit/shapio/models/page.json +93 -0
  124. package/templates/sveltekit/shapio/models/siteSettings.json +87 -0
  125. package/templates/sveltekit/src/app.html +12 -0
  126. package/templates/sveltekit/src/env.ts +16 -0
  127. package/templates/sveltekit/src/hooks.server.ts +9 -0
  128. package/templates/sveltekit/src/lib/articles.ts +5 -0
  129. package/templates/sveltekit/src/lib/components/ArticleCard.svelte +21 -0
  130. package/templates/sveltekit/src/lib/components/ArticleView.svelte +43 -0
  131. package/templates/sveltekit/src/lib/components/Byline.svelte +14 -0
  132. package/templates/sveltekit/src/lib/components/CallToAction.svelte +15 -0
  133. package/templates/sveltekit/src/lib/components/FeatureGrid.svelte +22 -0
  134. package/templates/sveltekit/src/lib/components/Gallery.svelte +25 -0
  135. package/templates/sveltekit/src/lib/components/Hero.svelte +24 -0
  136. package/templates/sveltekit/src/lib/components/ResponsiveImage.svelte +30 -0
  137. package/templates/sveltekit/src/lib/components/RichText.svelte +13 -0
  138. package/templates/sveltekit/src/lib/components/Sections.svelte +30 -0
  139. package/templates/sveltekit/src/lib/preview.ts +56 -0
  140. package/templates/sveltekit/src/lib/server/config.ts +46 -0
  141. package/templates/sveltekit/src/lib/server/shapio.ts +93 -0
  142. package/templates/sveltekit/src/lib/site.css +199 -0
  143. package/templates/sveltekit/src/lib/site.ts +66 -0
  144. package/templates/sveltekit/src/lib/types.ts +96 -0
  145. package/templates/sveltekit/src/routes/+layout.ts +3 -0
  146. package/templates/sveltekit/src/routes/+page.ts +7 -0
  147. package/templates/sveltekit/src/routes/[locale]/+layout.server.ts +16 -0
  148. package/templates/sveltekit/src/routes/[locale]/+layout.svelte +32 -0
  149. package/templates/sveltekit/src/routes/[locale]/[...slug]/+page.server.ts +28 -0
  150. package/templates/sveltekit/src/routes/[locale]/[...slug]/+page.svelte +15 -0
  151. package/templates/sveltekit/src/routes/[locale]/articles/+page.server.ts +9 -0
  152. package/templates/sveltekit/src/routes/[locale]/articles/+page.svelte +17 -0
  153. package/templates/sveltekit/src/routes/[locale]/articles/[slug]/+page.server.ts +25 -0
  154. package/templates/sveltekit/src/routes/[locale]/articles/[slug]/+page.svelte +15 -0
  155. package/templates/sveltekit/src/routes/[locale]/colophon/+page.svelte +17 -0
  156. package/templates/sveltekit/src/routes/[locale]/colophon/+page.ts +5 -0
  157. package/templates/sveltekit/src/routes/preview/+page.server.ts +5 -0
  158. package/templates/sveltekit/src/routes/preview/+page.svelte +67 -0
  159. package/templates/sveltekit/static/favicon.svg +9 -0
  160. package/templates/sveltekit/tsconfig.json +14 -0
  161. package/templates/sveltekit/vite.config.ts +63 -0
@@ -0,0 +1,51 @@
1
+ {
2
+ "apiKey": "featureGrid",
3
+ "category": "Sections",
4
+ "display": {},
5
+ "fields": [
6
+ {
7
+ "apiKey": "heading",
8
+ "deprecated": false,
9
+ "editor": {
10
+ "id": "textInput",
11
+ "options": {}
12
+ },
13
+ "filterable": false,
14
+ "id": "9936c9f6-f438-4de7-accc-14e37f0ce82d",
15
+ "label": "Heading",
16
+ "localized": false,
17
+ "public": true,
18
+ "required": false,
19
+ "settings": {},
20
+ "sortable": false,
21
+ "type": "string",
22
+ "unique": false
23
+ },
24
+ {
25
+ "apiKey": "features",
26
+ "deprecated": false,
27
+ "editor": {
28
+ "id": "componentEditor",
29
+ "options": {}
30
+ },
31
+ "filterable": false,
32
+ "id": "ecef464c-e05f-4f7c-80ce-f5ede8117af9",
33
+ "label": "Features",
34
+ "localized": false,
35
+ "public": true,
36
+ "required": false,
37
+ "settings": {
38
+ "component": "66138d48-8c29-499e-ba51-86e5fb1b372b",
39
+ "max": 12,
40
+ "min": 1,
41
+ "repeatable": true
42
+ },
43
+ "sortable": false,
44
+ "type": "component",
45
+ "unique": false
46
+ }
47
+ ],
48
+ "id": "c292bae8-15f5-45e1-808c-d67cea02c993",
49
+ "kind": "component",
50
+ "label": "Feature grid"
51
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "apiKey": "gallery",
3
+ "category": "Sections",
4
+ "display": {},
5
+ "fields": [
6
+ {
7
+ "apiKey": "heading",
8
+ "deprecated": false,
9
+ "editor": {
10
+ "id": "textInput",
11
+ "options": {}
12
+ },
13
+ "filterable": false,
14
+ "id": "9cf1f232-3b25-44e9-9fe1-f599a71ac712",
15
+ "label": "Heading",
16
+ "localized": false,
17
+ "public": true,
18
+ "required": false,
19
+ "settings": {},
20
+ "sortable": false,
21
+ "type": "string",
22
+ "unique": false
23
+ },
24
+ {
25
+ "apiKey": "images",
26
+ "deprecated": false,
27
+ "editor": {
28
+ "id": "mediaPicker",
29
+ "options": {}
30
+ },
31
+ "filterable": false,
32
+ "id": "87b1288e-d883-4ca5-8ab7-80fedb2b2fa0",
33
+ "label": "Images",
34
+ "localized": false,
35
+ "public": true,
36
+ "required": false,
37
+ "settings": {
38
+ "allowedKinds": [
39
+ "image"
40
+ ],
41
+ "min": 1,
42
+ "multiple": true
43
+ },
44
+ "sortable": false,
45
+ "type": "media",
46
+ "unique": false
47
+ }
48
+ ],
49
+ "id": "b8da2c63-3d0a-41a3-b2b2-d40d08cacddc",
50
+ "kind": "component",
51
+ "label": "Gallery"
52
+ }
@@ -0,0 +1,108 @@
1
+ {
2
+ "apiKey": "hero",
3
+ "category": "Sections",
4
+ "display": {},
5
+ "fields": [
6
+ {
7
+ "apiKey": "heading",
8
+ "deprecated": false,
9
+ "editor": {
10
+ "id": "textInput",
11
+ "options": {}
12
+ },
13
+ "filterable": false,
14
+ "id": "ee5d24bc-62aa-4f43-9382-11fdb2cab2c5",
15
+ "label": "Heading",
16
+ "localized": false,
17
+ "public": true,
18
+ "required": true,
19
+ "settings": {},
20
+ "sortable": false,
21
+ "type": "string",
22
+ "unique": false
23
+ },
24
+ {
25
+ "apiKey": "subheading",
26
+ "deprecated": false,
27
+ "editor": {
28
+ "id": "textarea",
29
+ "options": {}
30
+ },
31
+ "filterable": false,
32
+ "id": "b6d8e920-2292-4ef5-9563-27918825f6c9",
33
+ "label": "Subheading",
34
+ "localized": false,
35
+ "public": true,
36
+ "required": false,
37
+ "settings": {},
38
+ "sortable": false,
39
+ "type": "text",
40
+ "unique": false
41
+ },
42
+ {
43
+ "apiKey": "image",
44
+ "deprecated": false,
45
+ "editor": {
46
+ "id": "mediaPicker",
47
+ "options": {}
48
+ },
49
+ "filterable": false,
50
+ "id": "add9554e-3e48-49f6-a352-2847b10e41dd",
51
+ "label": "Image",
52
+ "localized": false,
53
+ "public": true,
54
+ "required": false,
55
+ "settings": {
56
+ "allowedKinds": [
57
+ "image"
58
+ ],
59
+ "multiple": false
60
+ },
61
+ "sortable": false,
62
+ "type": "media",
63
+ "unique": false
64
+ },
65
+ {
66
+ "apiKey": "ctaLabel",
67
+ "deprecated": false,
68
+ "editor": {
69
+ "id": "textInput",
70
+ "options": {}
71
+ },
72
+ "filterable": false,
73
+ "id": "04f43999-b796-4ac2-a40e-33819acaaa2d",
74
+ "label": "Button label",
75
+ "localized": false,
76
+ "public": true,
77
+ "required": false,
78
+ "settings": {},
79
+ "sortable": false,
80
+ "type": "string",
81
+ "unique": false
82
+ },
83
+ {
84
+ "apiKey": "ctaUrl",
85
+ "deprecated": false,
86
+ "description": "A full URL, a mailto: or tel: link, or a path on this site such as /en/articles/",
87
+ "editor": {
88
+ "id": "textInput",
89
+ "options": {}
90
+ },
91
+ "filterable": false,
92
+ "id": "3bd06878-6873-4595-9608-0505e8821111",
93
+ "label": "Button link",
94
+ "localized": false,
95
+ "public": true,
96
+ "required": false,
97
+ "settings": {
98
+ "pattern": "^(https?://|mailto:|tel:|/)"
99
+ },
100
+ "sortable": false,
101
+ "type": "string",
102
+ "unique": false
103
+ }
104
+ ],
105
+ "id": "1ce854fc-b87d-4e38-aec6-e3c76938dd87",
106
+ "kind": "component",
107
+ "label": "Hero"
108
+ }
@@ -0,0 +1,150 @@
1
+ {
2
+ "apiKey": "article",
3
+ "display": {
4
+ "titleFieldId": "d3e07d0a-c417-460c-8508-44146a81b096"
5
+ },
6
+ "draftAndPublish": true,
7
+ "fields": [
8
+ {
9
+ "apiKey": "title",
10
+ "deprecated": false,
11
+ "editor": {
12
+ "id": "textInput",
13
+ "options": {}
14
+ },
15
+ "filterable": false,
16
+ "id": "d3e07d0a-c417-460c-8508-44146a81b096",
17
+ "label": "Title",
18
+ "localized": true,
19
+ "public": true,
20
+ "required": true,
21
+ "settings": {},
22
+ "sortable": false,
23
+ "type": "string",
24
+ "unique": false
25
+ },
26
+ {
27
+ "apiKey": "slug",
28
+ "deprecated": false,
29
+ "editor": {
30
+ "id": "slugInput",
31
+ "options": {}
32
+ },
33
+ "filterable": true,
34
+ "id": "ee6ff3b9-628d-4ed0-8efa-ad78f4792e7a",
35
+ "label": "Slug",
36
+ "localized": false,
37
+ "public": true,
38
+ "required": true,
39
+ "settings": {},
40
+ "sortable": false,
41
+ "type": "slug",
42
+ "unique": true
43
+ },
44
+ {
45
+ "apiKey": "excerpt",
46
+ "deprecated": false,
47
+ "editor": {
48
+ "id": "textarea",
49
+ "options": {}
50
+ },
51
+ "filterable": false,
52
+ "id": "2dbdad0c-d445-4813-872b-48905f1135bd",
53
+ "label": "Excerpt",
54
+ "localized": true,
55
+ "public": true,
56
+ "required": false,
57
+ "settings": {},
58
+ "sortable": false,
59
+ "type": "text",
60
+ "unique": false
61
+ },
62
+ {
63
+ "apiKey": "body",
64
+ "deprecated": false,
65
+ "editor": {
66
+ "id": "richText",
67
+ "options": {}
68
+ },
69
+ "filterable": false,
70
+ "id": "f373cea2-0a43-4035-a832-ace63ebfaa7b",
71
+ "label": "Body",
72
+ "localized": true,
73
+ "public": true,
74
+ "required": false,
75
+ "settings": {
76
+ "formatVersion": 1
77
+ },
78
+ "sortable": false,
79
+ "type": "richtext",
80
+ "unique": false
81
+ },
82
+ {
83
+ "apiKey": "cover",
84
+ "deprecated": false,
85
+ "editor": {
86
+ "id": "mediaPicker",
87
+ "options": {}
88
+ },
89
+ "filterable": false,
90
+ "id": "c1c98382-15bd-4ee9-bc1c-0a624be6a648",
91
+ "label": "Cover",
92
+ "localized": false,
93
+ "public": true,
94
+ "required": false,
95
+ "settings": {
96
+ "allowedKinds": [
97
+ "image"
98
+ ],
99
+ "multiple": false
100
+ },
101
+ "sortable": false,
102
+ "type": "media",
103
+ "unique": false
104
+ },
105
+ {
106
+ "apiKey": "author",
107
+ "deprecated": false,
108
+ "editor": {
109
+ "id": "relationPicker",
110
+ "options": {}
111
+ },
112
+ "filterable": false,
113
+ "id": "b6f91e18-bc41-44a5-a172-afe6cd978dbf",
114
+ "label": "Author",
115
+ "localized": false,
116
+ "public": true,
117
+ "required": false,
118
+ "settings": {
119
+ "cardinality": "one",
120
+ "target": "d47e030e-1eef-4441-9b3d-44f53f7ab1f5"
121
+ },
122
+ "sortable": false,
123
+ "type": "relation",
124
+ "unique": false
125
+ },
126
+ {
127
+ "apiKey": "publishedOn",
128
+ "deprecated": false,
129
+ "editor": {
130
+ "id": "datePicker",
131
+ "options": {}
132
+ },
133
+ "filterable": false,
134
+ "id": "1bc4a6d7-51ca-47f9-a019-ba57e9d6a8ee",
135
+ "label": "Published on",
136
+ "localized": false,
137
+ "public": true,
138
+ "required": true,
139
+ "settings": {},
140
+ "sortable": true,
141
+ "type": "date",
142
+ "unique": false
143
+ }
144
+ ],
145
+ "id": "1679d89c-747f-4dfc-955f-7d47bd5e4f6b",
146
+ "kind": "collection",
147
+ "label": "Article",
148
+ "localized": true,
149
+ "pluralApiKey": "articles"
150
+ }
@@ -0,0 +1,73 @@
1
+ {
2
+ "apiKey": "author",
3
+ "display": {
4
+ "titleFieldId": "aaff4c95-891a-4cb7-9668-4602ed5649de"
5
+ },
6
+ "draftAndPublish": true,
7
+ "fields": [
8
+ {
9
+ "apiKey": "name",
10
+ "deprecated": false,
11
+ "editor": {
12
+ "id": "textInput",
13
+ "options": {}
14
+ },
15
+ "filterable": false,
16
+ "id": "aaff4c95-891a-4cb7-9668-4602ed5649de",
17
+ "label": "Name",
18
+ "localized": false,
19
+ "public": true,
20
+ "required": true,
21
+ "settings": {},
22
+ "sortable": false,
23
+ "type": "string",
24
+ "unique": false
25
+ },
26
+ {
27
+ "apiKey": "bio",
28
+ "deprecated": false,
29
+ "editor": {
30
+ "id": "textarea",
31
+ "options": {}
32
+ },
33
+ "filterable": false,
34
+ "id": "932fa059-07d4-4ff1-b241-4b5edb3cd23b",
35
+ "label": "Bio",
36
+ "localized": false,
37
+ "public": true,
38
+ "required": false,
39
+ "settings": {},
40
+ "sortable": false,
41
+ "type": "text",
42
+ "unique": false
43
+ },
44
+ {
45
+ "apiKey": "avatar",
46
+ "deprecated": false,
47
+ "editor": {
48
+ "id": "mediaPicker",
49
+ "options": {}
50
+ },
51
+ "filterable": false,
52
+ "id": "75f2dc14-15a0-412b-adea-8a60ed54a419",
53
+ "label": "Avatar",
54
+ "localized": false,
55
+ "public": true,
56
+ "required": false,
57
+ "settings": {
58
+ "allowedKinds": [
59
+ "image"
60
+ ],
61
+ "multiple": false
62
+ },
63
+ "sortable": false,
64
+ "type": "media",
65
+ "unique": false
66
+ }
67
+ ],
68
+ "id": "d47e030e-1eef-4441-9b3d-44f53f7ab1f5",
69
+ "kind": "collection",
70
+ "label": "Author",
71
+ "localized": false,
72
+ "pluralApiKey": "authors"
73
+ }
@@ -0,0 +1,93 @@
1
+ {
2
+ "apiKey": "page",
3
+ "display": {
4
+ "titleFieldId": "9b7d0249-e547-4b23-b7d0-c3b2e95fa4e9"
5
+ },
6
+ "draftAndPublish": true,
7
+ "fields": [
8
+ {
9
+ "apiKey": "title",
10
+ "deprecated": false,
11
+ "editor": {
12
+ "id": "textInput",
13
+ "options": {}
14
+ },
15
+ "filterable": false,
16
+ "id": "9b7d0249-e547-4b23-b7d0-c3b2e95fa4e9",
17
+ "label": "Title",
18
+ "localized": true,
19
+ "public": true,
20
+ "required": true,
21
+ "settings": {},
22
+ "sortable": false,
23
+ "type": "string",
24
+ "unique": false
25
+ },
26
+ {
27
+ "apiKey": "slug",
28
+ "deprecated": false,
29
+ "editor": {
30
+ "id": "slugInput",
31
+ "options": {}
32
+ },
33
+ "filterable": true,
34
+ "id": "41cb0daf-fed5-42e2-8ba8-f14831b025c4",
35
+ "label": "Slug",
36
+ "localized": false,
37
+ "public": true,
38
+ "required": true,
39
+ "settings": {},
40
+ "sortable": false,
41
+ "type": "slug",
42
+ "unique": true
43
+ },
44
+ {
45
+ "apiKey": "description",
46
+ "deprecated": false,
47
+ "editor": {
48
+ "id": "textarea",
49
+ "options": {}
50
+ },
51
+ "filterable": false,
52
+ "id": "504a303c-5e53-4716-a378-acbe9f20f7f5",
53
+ "label": "Description",
54
+ "localized": true,
55
+ "public": true,
56
+ "required": false,
57
+ "settings": {},
58
+ "sortable": false,
59
+ "type": "text",
60
+ "unique": false
61
+ },
62
+ {
63
+ "apiKey": "sections",
64
+ "deprecated": false,
65
+ "editor": {
66
+ "id": "dynamicZoneEditor",
67
+ "options": {}
68
+ },
69
+ "filterable": false,
70
+ "id": "113108bb-0666-4722-b2a5-a96a4be263a0",
71
+ "label": "Sections",
72
+ "localized": true,
73
+ "public": true,
74
+ "required": false,
75
+ "settings": {
76
+ "components": [
77
+ "1ce854fc-b87d-4e38-aec6-e3c76938dd87",
78
+ "c292bae8-15f5-45e1-808c-d67cea02c993",
79
+ "b8da2c63-3d0a-41a3-b2b2-d40d08cacddc",
80
+ "be8255cc-2588-4204-950e-ad3d84db4f2e"
81
+ ]
82
+ },
83
+ "sortable": false,
84
+ "type": "dynamiczone",
85
+ "unique": false
86
+ }
87
+ ],
88
+ "id": "4c09af05-f302-4d8f-ba03-bb838d3afbd2",
89
+ "kind": "collection",
90
+ "label": "Page",
91
+ "localized": true,
92
+ "pluralApiKey": "pages"
93
+ }
@@ -0,0 +1,87 @@
1
+ {
2
+ "apiKey": "siteSettings",
3
+ "display": {
4
+ "titleFieldId": "e54b64bb-62c9-4a9c-8842-f8af5151feac"
5
+ },
6
+ "draftAndPublish": true,
7
+ "fields": [
8
+ {
9
+ "apiKey": "siteName",
10
+ "deprecated": false,
11
+ "editor": {
12
+ "id": "textInput",
13
+ "options": {}
14
+ },
15
+ "filterable": false,
16
+ "id": "e54b64bb-62c9-4a9c-8842-f8af5151feac",
17
+ "label": "Site name",
18
+ "localized": true,
19
+ "public": true,
20
+ "required": true,
21
+ "settings": {},
22
+ "sortable": false,
23
+ "type": "string",
24
+ "unique": false
25
+ },
26
+ {
27
+ "apiKey": "tagline",
28
+ "deprecated": false,
29
+ "editor": {
30
+ "id": "textarea",
31
+ "options": {}
32
+ },
33
+ "filterable": false,
34
+ "id": "51448036-f103-46fa-8e2c-25e56e1c25fd",
35
+ "label": "Tagline",
36
+ "localized": true,
37
+ "public": true,
38
+ "required": false,
39
+ "settings": {},
40
+ "sortable": false,
41
+ "type": "text",
42
+ "unique": false
43
+ },
44
+ {
45
+ "apiKey": "footer",
46
+ "deprecated": false,
47
+ "editor": {
48
+ "id": "textInput",
49
+ "options": {}
50
+ },
51
+ "filterable": false,
52
+ "id": "49c371ca-eb2f-4bed-b831-6dbc74ea6628",
53
+ "label": "Footer text",
54
+ "localized": true,
55
+ "public": true,
56
+ "required": false,
57
+ "settings": {},
58
+ "sortable": false,
59
+ "type": "string",
60
+ "unique": false
61
+ },
62
+ {
63
+ "apiKey": "colophon",
64
+ "deprecated": false,
65
+ "editor": {
66
+ "id": "richText",
67
+ "options": {}
68
+ },
69
+ "filterable": false,
70
+ "id": "797ba365-a0fe-4572-a90f-9b524d12dc06",
71
+ "label": "Colophon",
72
+ "localized": true,
73
+ "public": true,
74
+ "required": false,
75
+ "settings": {
76
+ "formatVersion": 1
77
+ },
78
+ "sortable": false,
79
+ "type": "richtext",
80
+ "unique": false
81
+ }
82
+ ],
83
+ "id": "a1471f8b-5ee4-4a27-a7e0-934bb872b479",
84
+ "kind": "singleton",
85
+ "label": "Site settings",
86
+ "localized": true
87
+ }
@@ -0,0 +1,40 @@
1
+ import type { Metadata } from 'next';
2
+ import { notFound } from 'next/navigation';
3
+ import { Sections } from '../../../components/Sections';
4
+ import { listPages } from '../../../lib/shapio';
5
+ import { HOME_SLUG, toLocale, type Locale } from '../../../lib/site';
6
+
7
+ /**
8
+ * Pages from the `page` collection; `home` is the locale's front page (`/en/`), the others `/en/<slug>/`.
9
+ * Slugs published after the build render on their first request (and are cached); unknown slugs are a 404.
10
+ */
11
+ export const dynamicParams = true;
12
+
13
+ export const generateStaticParams = async ({ params }: { params: { locale: string } }) =>
14
+ (await listPages(toLocale(params.locale))).map((page) => ({
15
+ slug: page.slug === HOME_SLUG ? [] : [page.slug],
16
+ }));
17
+
18
+ type PageParams = { params: Promise<{ locale: string; slug?: string[] }> };
19
+
20
+ const findPage = async (locale: Locale, slug: string[] | undefined) => {
21
+ const wanted = slug?.join('/') ?? HOME_SLUG;
22
+ return (await listPages(locale)).find((page) => page.slug === wanted);
23
+ };
24
+
25
+ export const generateMetadata = async ({ params }: PageParams): Promise<Metadata> => {
26
+ const { locale, slug } = await params;
27
+ const page = await findPage(toLocale(locale), slug);
28
+ return page ? { title: page.title, description: page.description ?? undefined } : {};
29
+ };
30
+
31
+ const ContentPage = async ({ params }: PageParams) => {
32
+ const { locale, slug } = await params;
33
+ const page = await findPage(toLocale(locale), slug);
34
+ if (!page) {
35
+ notFound();
36
+ }
37
+ return <Sections page={page} />;
38
+ };
39
+
40
+ export default ContentPage;
@@ -0,0 +1,37 @@
1
+ import type { Metadata } from 'next';
2
+ import { notFound } from 'next/navigation';
3
+ import { ArticleView } from '../../../../components/ArticleView';
4
+ import { listArticles } from '../../../../lib/shapio';
5
+ import { stringsFor, toLocale, type Locale } from '../../../../lib/site';
6
+
7
+ /**
8
+ * Published articles only: a draft's URL is a 404. Articles published after the build render on their first
9
+ * request (and are cached); /api/revalidate refreshes them when they change.
10
+ */
11
+ export const dynamicParams = true;
12
+
13
+ export const generateStaticParams = async ({ params }: { params: { locale: string } }) =>
14
+ (await listArticles(toLocale(params.locale))).map((article) => ({ slug: article.slug }));
15
+
16
+ type ArticleParams = { params: Promise<{ locale: string; slug: string }> };
17
+
18
+ const findArticle = async (locale: Locale, slug: string) =>
19
+ (await listArticles(locale)).find((article) => article.slug === slug);
20
+
21
+ export const generateMetadata = async ({ params }: ArticleParams): Promise<Metadata> => {
22
+ const { locale, slug } = await params;
23
+ const article = await findArticle(toLocale(locale), slug);
24
+ return article ? { title: article.title, description: article.excerpt ?? undefined } : {};
25
+ };
26
+
27
+ const ArticlePage = async ({ params }: ArticleParams) => {
28
+ const { locale: segment, slug } = await params;
29
+ const locale = toLocale(segment);
30
+ const article = await findArticle(locale, slug);
31
+ if (!article) {
32
+ notFound();
33
+ }
34
+ return <ArticleView article={article} locale={locale} strings={stringsFor(locale)} />;
35
+ };
36
+
37
+ export default ArticlePage;