-
Notifications
You must be signed in to change notification settings - Fork 1
✨️ | Feat: simple blog #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a5ba988
✨️ | Add Blog page (base)
T-b-t-nchos f0a4b24
📗 | Add Placeholder article
T-b-t-nchos d9058e9
🔧 | Improve design
T-b-t-nchos 447eda7
🔧 | Remove unnecessary ".@.tailwind"
T-b-t-nchos a49312a
🔧 | Fix Package files
T-b-t-nchos f0b7b64
🔧 | Remove development code
T-b-t-nchos 10f17ec
🔧 | Change the back link to an absolute path
T-b-t-nchos 4a82c62
🔧 | Remove unnecessary import
T-b-t-nchos 37462b7
🔧 | Fix getAllPosts logic
T-b-t-nchos 0650581
🔧 | Fix Typo "darkmode"->"darkMode"
T-b-t-nchos 467da5f
🔧 | Update config for v4
T-b-t-nchos e0857fd
📗 | Fix typo "なくても"→"あっても"
T-b-t-nchos 945ca84
📗 | Add language identifier
T-b-t-nchos c6f5c27
🔧 | Add Error handling
T-b-t-nchos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| --- | ||
| title: "ブログができました。" | ||
| date: "2025-10-29" | ||
| description: "簡易的なブログができちゃいましたよ。どうしよう" | ||
| --- | ||
| # 🎉 | やったぜ | ||
|
|
||
| 紆余曲折の結果、なんとかブログ(笑)を完成させました。 | ||
| 多分ほぼ使わない。 | ||
| まあ、あっても困らんでしょう理論。 | ||
|
|
||
| --- | ||
|
|
||
| 以下、テスト | ||
|
|
||
| # レベル1の見出し | ||
|
|
||
| ## レベル2の見出し | ||
|
|
||
| ### レベル3の見出し | ||
|
|
||
| #### レベル4の見出し | ||
|
|
||
| ##### レベル5の見出し | ||
|
|
||
| ###### レベル6の見出し | ||
|
|
||
| > "このテキストは、HTMLのblockquote要素に囲まれます。 | ||
| > blockquote要素はreflowableです。テキストを好きなように | ||
| > 改行することができます。改行したとしても、変換後はひとつの | ||
| > blockquote要素として扱われます。" | ||
|
|
||
| * 順序無しリストのアイテム | ||
| * サブアイテムはタブもしくは4つのスペースでインデントする | ||
| * 順序無しリストの別のアイテム | ||
|
|
||
| 1. 順序付きリストのアイテム | ||
| 1. サブアイテムはタブもしくは4つのスペースでインデントする | ||
| 2. 順序付きリストの別のアイテム | ||
|
|
||
| これは段落です。文中に `コードテキスト`を含みます。 | ||
|
|
||
| ```text | ||
| This is CodeBlock Line 1. | ||
| This is CodeBlock Line 2. | ||
| This is CodeBlock Line 3. | ||
| ``` | ||
|
|
||
| [リンクのテキスト](リンクのアドレス "リンクのタイトル") | ||
|
|
||
| *強調*(斜体として表現されることが多い) | ||
| **強い強調**(太字として表現されることが多い) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import { getAllPosts, getPostBySlug } from "@/lib/posts"; | ||
| import { remark } from "remark"; | ||
| import html from "remark-html"; | ||
| import Link from "next/link"; | ||
| import { notFound } from 'next/navigation'; | ||
|
|
||
| type Props = { | ||
| params: Promise<{ slug: string }>; | ||
| }; | ||
|
|
||
| export async function generateStaticParams() { | ||
| const posts = getAllPosts(); | ||
| return posts.map((post) => ({ slug: post.slug })); | ||
| } | ||
|
|
||
| export default async function PostPage({ params }: Props) { | ||
| const { slug } = await params; | ||
|
|
||
| try { | ||
| const post = getPostBySlug(slug); | ||
| const processedContent = await remark().use(html).process(post.content); | ||
| const contentHtml = processedContent.toString(); | ||
|
|
||
| return ( | ||
| <div className="min-h-screen text-neutral-100 py-20 px-6"> | ||
| <article className="max-w-5xl mx-auto bg-neutral-900/80 border border-neutral-800 backdrop-blur-md rounded-2xl shadow-md overflow-hidden p-10"> | ||
| <header className="border-b border-neutral-800 pb-6 mb-10"> | ||
| <p className="text-sm text-green-400 tracking-wide uppercase"> | ||
| {new Date(post.meta.date).toLocaleDateString("ja-JP", { | ||
| year: "numeric", | ||
| month: "long", | ||
| day: "numeric", | ||
| })} | ||
| </p> | ||
| <h1 className="mt-3 text-3xl font-bold text-white">{post.meta.title}</h1> | ||
| {post.meta.description && ( | ||
| <p className="mt-3 text-neutral-400 text-sm leading-relaxed"> | ||
| {post.meta.description} | ||
| </p> | ||
| )} | ||
| </header> | ||
|
|
||
| <div | ||
| className="prose prose-invert lg:prose-xl max-w-none" | ||
| dangerouslySetInnerHTML={{ __html: contentHtml }} | ||
| /> | ||
|
|
||
| <footer className="border-t border-neutral-800 pt-6 mt-10"> | ||
| <Link href="/blog" className="mt-6 text-sm font-bold text-green-400 tracking-wide uppercase"> | ||
| → Back | ||
| </Link> | ||
| </footer> | ||
| </article> | ||
| </div> | ||
| ); | ||
| } catch (error) { | ||
| console.error(`Failed to load post ${slug}:`, error); | ||
| notFound(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,41 @@ | ||
| import Link from "next/link"; | ||
| import Image from "next/image"; | ||
| import { getAllPosts } from "@/lib/posts"; | ||
|
|
||
| export default async function BlogPage() { | ||
| const posts = getAllPosts(); | ||
|
|
||
| export default function BlogPage() { | ||
| return ( | ||
| <div className="items-centerrelative min-h-screen flex items-center justify-center overflow-hidden bg-neutral-950"> | ||
| <h1>Preparing...</h1> | ||
| <div className="text-neutral-100 py-20 px-6"> | ||
| <div className="max-w-3xl mx-auto"> | ||
|
|
||
| <ul className="mt-12 space-y-6"> | ||
| {posts.map((post) => ( | ||
| <li key={post.slug}> | ||
| <Link | ||
| href={`/blog/${post.slug}`} | ||
| className="block p-4 border border-neutral-800 rounded-xl bg-neutral-900/80 backdrop-blur-md hover:border-green-500/50 hover:text-green-400 transition-all duration-300" | ||
| > | ||
| <div className="flex justify-between items-center"> | ||
| <h2 className="text-xl font-semibold">{post.meta.title}</h2> | ||
| <span className="text-sm text-green-400"> | ||
| {new Date(post.meta.date).toLocaleDateString("ja-JP", { | ||
| year: "numeric", | ||
| month: "short", | ||
| day: "numeric", | ||
| })} | ||
| </span> | ||
| </div> | ||
| {post.meta.description && ( | ||
| <p className="mt-2 text-neutral-400 text-sm line-clamp-2"> | ||
| {post.meta.description} | ||
| </p> | ||
| )} | ||
| </Link> | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.