From 6b432ef0512d57d49d87a77793af6a6176a906c3 Mon Sep 17 00:00:00 2001 From: tubone24 Date: Thu, 21 May 2020 23:01:30 +0900 Subject: [PATCH] archive add --- src/templates/period-summary.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/templates/period-summary.js b/src/templates/period-summary.js index 6275797888..e98cc06076 100644 --- a/src/templates/period-summary.js +++ b/src/templates/period-summary.js @@ -6,6 +6,15 @@ import Sidebar from '../components/Sidebar'; const PeriodSummary = ({ data, pageContext }) => { const { displayMonth, displayYear } = pageContext; const { edges, totalCount } = data.allMarkdownRemark; + let title; + let url; + if (displayMonth == null) { + title = `${displayYear}年の記事 (${totalCount}件)`; + url = `https://blog.tubone-project24.xyz/${displayYear}/`; + } else { + title = `${displayYear}年${displayMonth}月の記事 (${totalCount}件)`; + url = `https://blog.tubone-project24.xyz/${displayYear}/${displayMonth}`; + } return (
{

- {displayYear}年{displayMonth}月の記事 ({totalCount}) + {title}

    {edges.map(({ node }) => { @@ -36,11 +45,11 @@ const PeriodSummary = ({ data, pageContext }) => {