Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | 2x 1x 1x 123x 413x 413x 158x 255x 1x 1214x 1x 255x 2x | import React from "react";
import { graphql } from "gatsby";
import Sidebar from "@/components/Sidebar";
import Tag from "@/components/Tag";
import SEO from "@/components/SEO";
import * as style from "./tags.module.scss";
const Tags = ({ data }: { data: GatsbyTypes.getAllTagsQuery }) => {
const mapping: { [key: string]: number } = {};
data.allMarkdownRemark.edges.forEach(({ node }) => {
node.frontmatter?.tags?.forEach((name) => {
Eif (name) {
if (mapping[name]) {
mapping[name] += 1;
} else {
mapping[name] = 1;
}
}
});
});
const tags = Array.from(Object.keys(mapping)).sort(
(b, a) => mapping[a] - mapping[b]
);
return (
<div className="container">
<div className={style.tagsRow + " row"}>
<Sidebar />
<div className={style.tagsPage + " col order-2"}>
{tags.map((item) => (
<Tag name={item} key={item} count={mapping[item]} />
))}
</div>
</div>
<SEO
title="Tags"
url="/tags/"
siteTitleAlt="tubone BOYAKI"
isPost={false}
description="Tags Page"
tag=""
image="https://i.imgur.com/M795H8A.jpg"
/>
</div>
);
};
export default Tags;
export const pageQuery = graphql`
query getAllTags {
allMarkdownRemark {
edges {
node {
frontmatter {
tags
}
}
}
}
}
`;
|