diff --git a/package.json b/package.json index 6a826e1..d803e59 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "www-aaronjy-me", - "version": "1.7.0.1", + "version": "1.7.1.0", "private": true, "type": "module", "scripts": { diff --git a/src/components/Article/Article.jsx b/src/components/Article/Article.jsx index e05c2a3..e1f2219 100644 --- a/src/components/Article/Article.jsx +++ b/src/components/Article/Article.jsx @@ -30,7 +30,7 @@ function Article ({ attributes, html }) { Back... {attributes.pubdate &&

{formatDate(attributes.pubdate)}

}
- {attributes.tags &&

Tags: {attributes.tags}

} + {attributes.tags &&

Tags: {attributes.tags.join(', ')}

}
diff --git a/src/pages/tags/index.js b/src/pages/tags/index.js index 2313b31..31854b5 100644 --- a/src/pages/tags/index.js +++ b/src/pages/tags/index.js @@ -2,6 +2,7 @@ import DefaultLayout from '@/layouts/DefaultLayout/DefaultLayout' import { getContentTags, getStaticEntries } from '@/lib/content' import { NextSeo } from 'next-seo' import Link from 'next/link' +import React from 'react' export const getStaticProps = () => ({ props: { @@ -13,8 +14,6 @@ export const getStaticProps = () => ({ export const Title = 'Tags' export default function Tags ({ tags, postEntries }) { - const tagNames = Object.keys(tags).sort() - return ( {Title}
+ {Object.keys(tags).sort().map(tag => { + const posts = postEntries + .filter(p => p.attributes.tags.includes(tag)) + .sort((a, b) => b.attributes.title > -a.attributes.title) - - - - - - - - - - {tagNames.map(tag => { - const posts = postEntries.filter(p => p.attributes.tags.includes(tag)).sort((a, b) => a.attributes.title > b.attributes.title ? 1 : -1) - - return ( - - - - - ) - })} - -
TagPosts
{tag} ({posts.length}) - {posts && posts.map(post => { - return ( -
{post.attributes.title}
- ) - })} -
+ return ( + +

{tag}

+
    + {posts.map((post, _) => { + return ( +
  • + {post.attributes.title} +
  • + ) + })} +
+
+ ) + })}
+
) }