Skip to content

Commit

Permalink
Add random notes page
Browse files Browse the repository at this point in the history
  • Loading branch information
myl7 committed Nov 9, 2023
1 parent 49f7228 commit 8b65ed0
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/random-notes/meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (C) myl7
// SPDX-License-Identifier: Apache-2.0

const meta = {
title: 'Random notes',
description: 'Notes about anything that come out of my mind with the guidance of the world',
url: '/random-notes',
pubDate: '2023-11-09',
updDate: '2023-11-09',
}
export default meta
59 changes: 59 additions & 0 deletions app/random-notes/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright (C) myl7
// SPDX-License-Identifier: Apache-2.0

import { serialize } from 'next-mdx-remote/serialize'

import MDXRemote from '@/app/mdx/mdxRemote'
import { remarkPlugins, rehypePlugins } from '@/app/mdx/plugins'

import src from './random-notes.md?raw'
import meta from './meta'

import type { Metadata } from 'next'

export const metadata: Metadata = {
title: meta.title,
description: meta.description,
alternates: {
canonical: meta.url,
},
openGraph: {
title: meta.title,
description: meta.description,
url: meta.url,
siteName: 'mylmoe',
type: 'article',
publishedTime: `${meta.pubDate}T00:00:00.000Z`,
modifiedTime: `${meta.updDate}T00:00:00.000Z`,
},
}

export default async function Page() {
const mdxSrc = await serialize(src, { mdxOptions: { remarkPlugins, rehypePlugins, format: 'md' } })

return (
<main>
<section className="flex flex-col gap-2 rounded border-2 border-bg-l4 bg-bg-l1 p-2 font-serif dark:border-bg-d4 dark:bg-bg-d1">
<h1 className="text-2xl">{meta.title}</h1>
<hr className="border-bg-l4 dark:border-bg-d4" />
<p className="text-sm">
{meta.pubDate == meta.updDate ? (
<>
updated & published on <time>{meta.updDate}</time>
</>
) : (
<>
updated on <time>{meta.updDate}</time> & published on <time>{meta.pubDate}</time>
</>
)}
</p>
<hr className="border-bg-l4 dark:border-bg-d4" />
<p>
<span className="italic">Abstract:</span> {meta.description}
</p>
<hr className="border-bg-l4 dark:border-bg-d4" />
<MDXRemote {...mdxSrc} />
</section>
</main>
)
}
8 changes: 8 additions & 0 deletions app/random-notes/random-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!-- Copyright (C) myl7 -->
<!-- SPDX-License-Identifier: CC0 -->

Old world blue is new world hope

## License

SPDX-License-Identifier: CC0

1 comment on commit 8b65ed0

@vercel
Copy link

@vercel vercel bot commented on 8b65ed0 Nov 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

mylmoe – ./

mylmoe.vercel.app
mylmoe-myl7.vercel.app
myl.moe
mylmoe-git-main-myl7.vercel.app
www.myl.moe

Please sign in to comment.