-
Notifications
You must be signed in to change notification settings - Fork 90
feat: barebones implementation of Blog Posts UI (WIP) #257
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
Draft
Kai-ros
wants to merge
5
commits into
npmx-dev:main
Choose a base branch
from
jonathanyeong:feat/atproto-blog-fe
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+259
−7
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5bee41f
feat: barebones implementation of Blog Posts UI (WIP)
Kai-ros 2d456a4
feat: generate blog posts content via markdown
jonathanyeong 8b8ea6f
feat: generate lexicons on postinstall & log out marshalling to stand…
jonathanyeong 880219c
fix: clean up comments
jonathanyeong 5202e64
fix: fix linting in markdown files
jonathanyeong 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
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,27 @@ | ||
| <script setup lang="ts"> | ||
| const props = defineProps<{ title: string; htmlContent: string; date: string }>() | ||
| </script> | ||
| <template> | ||
| <main class="container"> | ||
| <h1 class="text-4xl font-bold text-gray-900 dark:text-white mb-2"> | ||
| {{ title }} | ||
| </h1> | ||
| <!-- <time class="text-sm text-gray-500 dark:text-gray-400"> --> | ||
|
|
||
| <DateTime | ||
| :datetime="date" | ||
| year="numeric" | ||
| month="short" | ||
| day="numeric" | ||
| class="text-xs text-fg-subtle" | ||
| /> | ||
|
|
||
| <div class="" v-html="htmlContent" /> | ||
| </main> | ||
| </template> | ||
|
|
||
| <style> | ||
| .container { | ||
| background: var(--bg-blue); | ||
| } | ||
| </style> |
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,41 @@ | ||
| <script setup lang="ts"> | ||
| const route = useRoute() | ||
| const { data: post } = await useAsyncData(route.path, () => { | ||
| return queryCollection('blog').path(route.path).first() | ||
| }) | ||
|
|
||
| definePageMeta({ | ||
| name: `blog-post`, | ||
| // alias: ['/:path(.*)*'], | ||
| }) | ||
|
|
||
| useSeoMeta({ | ||
| title: () => post.value?.title || 'Blog', // TODO: How does i18n deal with dynamic values? $t('blog.post.title'), | ||
| description: () => (post.value?.description ? `Blog Article ${post.value?.description}` : ''), | ||
| }) | ||
| </script> | ||
|
|
||
| <template> | ||
| <main class="container py-8 sm:py-12 w-full"> | ||
| <!-- Header --> | ||
| <header class="mb-8 pb-8 border-b border-border"> | ||
| <div class="">I AM A WEAK HEADER</div> | ||
| </header> | ||
|
|
||
| <article v-if="post"> | ||
| <ContentRenderer v-if="post" :value="post" /> | ||
| </article> | ||
|
|
||
| <article v-else> | ||
| <h1>Post Not Found</h1> | ||
| <p>We couldn't find a post at /blog/{{ route.path }}</p> | ||
| </article> | ||
| </main> | ||
| </template> | ||
|
|
||
| <!-- TODO: styles --> | ||
| <style> | ||
| h1 { | ||
| @apply text-4xl font-bold text-gray-900 dark:text-white mb-2; | ||
| } | ||
| </style> |
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,40 @@ | ||
| <script setup lang="ts"> | ||
| const { data: posts } = await useAsyncData('blog-posts', () => | ||
| queryCollection('blog').where('draft', '<>', true).order('date', 'DESC').all(), | ||
| ) | ||
| definePageMeta({ | ||
| name: 'blog', | ||
| // alias: ['/:path(.*)*'], | ||
| }) | ||
| useSeoMeta({ | ||
| title: () => $t('blog.title'), | ||
| description: () => $t('blog.description'), | ||
| }) | ||
| </script> | ||
|
|
||
| <template> | ||
| <main class="container py-8 sm:py-12 w-full"> | ||
| <header class="mb-8 pb-8 border-b border-border"> | ||
| <div class="">I AM A MIGHTY HEADER</div> | ||
| </header> | ||
|
|
||
| <article class="flex flex-col gap-6"> | ||
| <div v-for="post in posts" :key="post.slug" class="p-4 border border-border rounded-lg"> | ||
| <h2 class="text-xl font-semibold"> | ||
| <NuxtLink :to="`/blog/${post.slug}`" class="text-primary hover:underline"> | ||
| {{ post.title }} | ||
| </NuxtLink> | ||
| </h2> | ||
| <p class="text-muted-foreground">{{ post.excerpt }}</p> | ||
| </div> | ||
| </article> | ||
| </main> | ||
| </template> | ||
|
|
||
| <style> | ||
| .container { | ||
| background: var(--bg-red); | ||
| } | ||
| </style> |
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,12 @@ | ||
| import { defineContentConfig, defineCollection } from '@nuxt/content' | ||
| import { BlogPostSchema } from './shared/schemas/blog' | ||
|
|
||
| export default defineContentConfig({ | ||
| collections: { | ||
| blog: defineCollection({ | ||
| type: 'page', | ||
| source: 'blog/**/*.md', | ||
| schema: BlogPostSchema, | ||
| }), | ||
| }, | ||
| }) |
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,12 @@ | ||
| --- | ||
| title: 'Hello World' | ||
| date: '2026-01-28' | ||
| slug: 'first-post' | ||
| description: 'My first post on the blog' | ||
| excerpt: 'My first post' | ||
| draft: false | ||
| --- | ||
|
|
||
| # My First Page | ||
|
|
||
| Here is some content. |
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,12 @@ | ||
| --- | ||
| title: 'Server Components' | ||
| date: '2026-01-28' | ||
| slug: 'server-components' | ||
| description: 'My first post on the blog' | ||
| excerpt: 'Zero JS' | ||
| draft: false | ||
| --- | ||
|
|
||
| # Server components | ||
|
|
||
| Here is some server component razzle dazzle. Hello there! |
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
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,31 @@ | ||
| import { defineNuxtModule, useNuxt } from 'nuxt/kit' | ||
| import * as site from '../shared/types/lexicons/site' | ||
|
|
||
| const PUBLICATION_SITE = 'https://npmx.dev' | ||
|
|
||
| export default defineNuxtModule({ | ||
| meta: { | ||
| name: 'standard-site-sync', | ||
| }, | ||
| setup() { | ||
| const nuxt = useNuxt() | ||
| if (nuxt.options._prepare) { | ||
| return | ||
| } | ||
| nuxt.hook('content:file:afterParse', ctx => { | ||
| const { content } = ctx | ||
|
|
||
| const document = site.standard.document.$build({ | ||
| site: PUBLICATION_SITE, | ||
| path: content.path as string, | ||
| title: content.title as string, | ||
| description: (content.excerpt || content.description) as string | undefined, | ||
| tags: content.tags as string[] | undefined, | ||
| publishedAt: new Date(content.date as string).toISOString(), | ||
| }) | ||
|
|
||
| // TODO: Mock PDS push | ||
| console.log('[standard-site-sync] Would push:', JSON.stringify(document, null, 2)) | ||
| }) | ||
| }, | ||
| }) |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kai-ros I'm wondering if we should move the blog link to the footer. What do you think?