chore: added tags to flow
44c3f8e2
2 file(s) · +18 −0
| 118 | 118 | placeholder: "ogImage, coverImage, image, hero, etc.", |
|
| 119 | 119 | }); |
|
| 120 | 120 | ||
| 121 | + | const tagsField = await consola.prompt("Field name for tags:", { |
|
| 122 | + | type: "text", |
|
| 123 | + | default: "tags", |
|
| 124 | + | placeholder: "tags, categories, keywords, etc.", |
|
| 125 | + | }); |
|
| 126 | + | ||
| 121 | 127 | let frontmatterMapping: FrontmatterMapping | undefined = {}; |
|
| 122 | 128 | ||
| 123 | 129 | if (titleField && titleField !== "title") { |
|
| 131 | 137 | } |
|
| 132 | 138 | if (coverField && coverField !== "ogImage") { |
|
| 133 | 139 | frontmatterMapping.coverImage = coverField as string; |
|
| 140 | + | } |
|
| 141 | + | if (tagsField && tagsField !== "tags") { |
|
| 142 | + | frontmatterMapping.tags = tagsField as string; |
|
| 134 | 143 | } |
|
| 135 | 144 | ||
| 136 | 145 | // Only keep frontmatterMapping if it has any custom fields |
|
| 183 | 183 | record.coverImage = coverImage; |
|
| 184 | 184 | } |
|
| 185 | 185 | ||
| 186 | + | if (post.frontmatter.tags && post.frontmatter.tags.length > 0) { |
|
| 187 | + | record.tags = post.frontmatter.tags; |
|
| 188 | + | } |
|
| 189 | + | ||
| 186 | 190 | const response = await agent.com.atproto.repo.createRecord({ |
|
| 187 | 191 | repo: agent.session!.did, |
|
| 188 | 192 | collection: "site.standard.document", |
|
| 227 | 231 | record.coverImage = coverImage; |
|
| 228 | 232 | } |
|
| 229 | 233 | ||
| 234 | + | if (post.frontmatter.tags && post.frontmatter.tags.length > 0) { |
|
| 235 | + | record.tags = post.frontmatter.tags; |
|
| 236 | + | } |
|
| 237 | + | ||
| 230 | 238 | await agent.com.atproto.repo.putRecord({ |
|
| 231 | 239 | repo: agent.session!.did, |
|
| 232 | 240 | collection: collection!, |
|
| 254 | 262 | publishedAt: string; |
|
| 255 | 263 | canonicalUrl?: string; |
|
| 256 | 264 | coverImage?: BlobObject; |
|
| 265 | + | tags?: string[]; |
|
| 257 | 266 | location?: string; |
|
| 258 | 267 | } |
|
| 259 | 268 | ||