import React from "react"; import Layout from "../components/Layout"; import { graphql } from "gatsby"; import { PaginationContext } from "../models/pagination.model"; import { AllGhostPostDescription } from "../models/all-post-description.model"; import PostCard from "../components/PostCard"; import Pagination from "../components/Pagination"; import { MetaData } from "../components/meta"; import classNames from "classnames"; import url from "url"; interface GhostTagDescription { description: string; feature_image: string; slug: string; name: string; postCount: number; } type TagTemplateProps = { location: any; pageContext: PaginationContext; data: { allGhostPost: AllGhostPostDescription; ghostTag: GhostTagDescription; }; }; const TagTemplate: React.FC = ({ data, location, pageContext, }) => { const { ghostTag, allGhostPost } = data; return (
{ghostTag.postCount} {ghostTag.postCount > 1 ? "posts" : "post"}

{ghostTag.name}

{ghostTag.description && (

)}
{allGhostPost.edges.map(({ node }, i) => { return ; })}
); }; export default TagTemplate; export const TagTemplateQuery = graphql` query($slug: String!, $limit: Int!, $skip: Int!) { ghostTag(slug: { eq: $slug }) { name description postCount feature_image slug } allGhostPost( sort: { order: DESC, fields: [published_at] } filter: { tags: { elemMatch: { slug: { eq: $slug } } } } limit: $limit skip: $skip ) { edges { ...AllGhostPostsDescription } } } `;