diff --git a/models/PostFeedTagLayout.yaml b/models/PostFeedTagLayout.yaml new file mode 100644 index 00000000..1c03d75f --- /dev/null +++ b/models/PostFeedTagLayout.yaml @@ -0,0 +1,7 @@ +name: PostFeedTagLayout +label: Blog Tag +labelField: title +layout: PostFeedTagLayout +hideContent: true +extends: + - PostFeedLayout diff --git a/models/PostLayout.yaml b/models/PostLayout.yaml index d0d9357e..fa42ad36 100644 --- a/models/PostLayout.yaml +++ b/models/PostLayout.yaml @@ -17,6 +17,13 @@ fields: label: Category models: - PostFeedCategoryLayout + - type: list + name: tags + label: Tags + items: + type: reference + models: + - PostFeedTagLayout - type: reference name: author label: Author @@ -35,7 +42,7 @@ fields: type: ImageBlock url: https://assets.stackbit.com/components/images/default/post-4.jpeg altText: Post thumbnail image - caption: "" + caption: '' - type: list name: bottomSections label: Sections diff --git a/src/components-manifest.json b/src/components-manifest.json index 32c2f41f..0ae9dfee 100644 --- a/src/components-manifest.json +++ b/src/components-manifest.json @@ -148,5 +148,10 @@ "path": "layouts/PostFeedCategoryLayout", "modelName": "PostFeedCategoryLayout", "isDynamic": true + }, + "PostFeedTagLayout": { + "path": "layouts/PostFeedTagLayout", + "modelName": "PostFeedTagLayout", + "isDynamic": true } } diff --git a/src/components/PostFeedSection/index.tsx b/src/components/PostFeedSection/index.tsx index 10b0e017..8cd83347 100644 --- a/src/components/PostFeedSection/index.tsx +++ b/src/components/PostFeedSection/index.tsx @@ -137,6 +137,7 @@ function postsVariantA(props) { {post.excerpt}
)} ++ {tags.map((tag, index) => ( + + {tag.title} + + ))} +
+ ); +} + function mapMinHeightStyles(height) { switch (height) { case 'auto': diff --git a/src/layouts/PostFeedTagLayout/index.tsx b/src/layouts/PostFeedTagLayout/index.tsx new file mode 100644 index 00000000..4e6b6605 --- /dev/null +++ b/src/layouts/PostFeedTagLayout/index.tsx @@ -0,0 +1,2 @@ +import PostFeedLayout from '../PostFeedLayout'; +export default PostFeedLayout; diff --git a/src/layouts/PostLayout/index.tsx b/src/layouts/PostLayout/index.tsx index 05d1ff86..f8cf27c1 100644 --- a/src/layouts/PostLayout/index.tsx +++ b/src/layouts/PostLayout/index.tsx @@ -32,6 +32,7 @@ export default function PostLayout(props) { {page.markdown_content} )} +