Skip to content

Commit

Permalink
add more post meta
Browse files Browse the repository at this point in the history
  • Loading branch information
algasami committed May 14, 2024
1 parent ef3e6ca commit e5edc42
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/[lang]/posts/[slug]/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const buildProps = (slug: string, lang: Locale) => {
const post = {
title: postFull.title,
date: postFull.date,
slug: slug,
description: postFull.description,
body: {
code: postFull.body.code,
Expand Down
27 changes: 24 additions & 3 deletions app/components/postLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ import formatDate from "./formatDate";
import PostBody from "./postBody";
import { Locale } from "i18n-config";
import { getDictionary } from "get-dictionary";
import { Icon } from "@mui/material";
import { CalendarToday, Source } from "@mui/icons-material";

export interface PostForPostLayout {
date: string;
title: string;
slug: string;
}

export type RelatedPostForPostLayout = {
Expand Down Expand Up @@ -41,10 +44,28 @@ export default function PostLayout({
</div>

<dl className="space-y-10">
<div>
<dd className="text-base font-medium leading-6 text-gray-500 transition-colors dark:text-gray-400">
<div className="text-base font-medium leading-6 text-gray-500 transition-colors dark:text-gray-400 flex flex-row justify-center">
<div id="post-publish-date" className="flex flex-col mx-2">
<Icon className="flex flex-row justify-center w-full mb-2">
<CalendarToday color="inherit" />
{dict.date}
</Icon>
<time dateTime={date}>{formatDate(date, locale)}</time>
</dd>
</div>
<div id="post-source-code" className="flex flex-col mx-2">
<Icon className="flex flex-row justify-center w-full mb-2">
<Source color="inherit" />
{dict.source}(GitHub)
</Icon>
<a
className="dynamic-link"
href={`https://github.com/algasami/algasami.github.io/tree/main/app/content/posts/${post.slug}.mdx`}
target="_blank"
rel="noreferrer noopener"
>
{post.slug}.mdx
</a>
</div>
</div>
</dl>
</div>
Expand Down
4 changes: 4 additions & 0 deletions dictionaries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ export const en = {
meta_description: "Repository for the site's posts.",
next: "Next Post",
last: "Last Post",
date: "Date",
source: "Source",
},
graph: {
title: "Graph",
Expand Down Expand Up @@ -234,6 +236,8 @@ export const zh_tw: typeof en = {
meta_description: "本網站的貼文儲存點。",
next: "下一篇",
last: "上一篇",
date: "日期",
source: "來源",
},
graph: {
title: "圖論",
Expand Down

0 comments on commit e5edc42

Please sign in to comment.