目次
client.tsに追加
UpdateDate: prop.UpdateDate.date ? prop.UpdateDate.date.start : '',
src\lib\notion\client.ts
![Image in a image block](/notion/b6226e51-5a50-41ff-b71f-4c033aaae7b1/Untitled.png)
PostUpdateDate.astroの作成
src\components\PostUpdateDate.astro
を新規作成します。
---
import { Post } from '../lib/interfaces.ts'
import { getDateStr } from '../lib/blog-helpers.ts'
export interface Props {
post: Post
}
const { post } = Astro.props
---
<div class="post-date">
{post.UpdateDate ? <span>更新日:{getDateStr(post.UpdateDate)}</span> : ''}
</div>
<style>
.post-date {
margin-block: 0.3rem;
font-size: 0.9rem;
}
</style>
src\components\PostUpdateDate.astro
![Image in a image block](/notion/a4229cd5-bb7d-4d25-8336-9890e00accba/Untitled.png)
PostDate.astroの修正
{post.Date ? <span>投稿日:{getDateStr(post.Date)}</span> : ''}
src\components\PostDate.astro
![Image in a image block](/notion/4ba8697b-41c5-4f38-adef-330117636aae/Untitled.png)
ページの修正
![Image in a image block](/notion/db757c67-0f24-4e17-b223-95fb281e551f/Untitled.png)
src\pages\index.astro
![Image in a image block](/notion/da60d737-ceca-4faf-9b61-fd6c4be9034a/Untitled.png)
src\pages\blog\[slug].astro
![Image in a image block](/notion/024abc59-4eac-4d9f-949a-050fe71e4030/Untitled.png)
src\pages\blog\page\[page].astro
![Image in a image block](/notion/530656c7-87ad-43a5-9cf9-ee2ebd38aaf9/Untitled.png)
src\pages\blog\tag\[tag].astro
![Image in a image block](/notion/1b29014a-1f54-4296-8b0b-e96f57e67961/Untitled.png)
src\pages\blog\tag\[tag]\page\[page].astro
![Image in a image block](/notion/e0fa997b-c46c-48f3-b623-8a2428d7f116/Untitled.png)
更新日が無いページは勝手に空になります。
![Image in a image block](/notion/4e03352f-34eb-4236-919f-20a03d6074ca/Untitled.png)
ここまで小さくなることなんて無いとは思うんですが、一応レスポンシブ対応です。勝手に折り返されます。