+
+
+
Recent updates
-
+
This blog is maintained using NotCMS itself!
-
-
-
-
-
-
-
-
-
+
+
+ {categories.map((category) => (
+
+ ))}
-
- w.id === pages[0].properties.writers?.[0]
- )}
- />
-
-
- {pages.map((page) => {
+
+ {filteredPages.length > 0 && (
+ w.id === filteredPages[0].properties.writers?.[0]
+ )}
+ />
+ )}
+
+
+ {filteredPages.slice(1).map((page) => {
const writer = writers.find(
(w) => w.id === page.properties.writers?.[0]
);
@@ -88,47 +107,47 @@ function HeroBlogPostCard({ className, page, writer }: Props) {
return (
-
+
-
-
-
-
+
+
+
+
{page.title}
-
+
{page.properties.description}
-
-
-
+
+
+
-
+
{writer?.title}
-
-
+
+
{page.properties.category}
@@ -138,31 +157,29 @@ function HeroBlogPostCard({ className, page, writer }: Props) {
);
}
+
function BlogPostCard({ className, page, writer }: Props) {
return (
- // TODO: border?
-
+
-
-
+
+
{page.title}
-
+
-
+
{writer?.title}
-
+
{page.properties.category}
-
+
{new Date(
page.properties.created_at ?? Date.now()
).toLocaleDateString()}
diff --git a/examples/nextjs-simple-blog-template/components/blog/main-content.tsx b/examples/nextjs-simple-blog-template/components/blog/main-content.tsx
index 2dd932d..0ccdca2 100644
--- a/examples/nextjs-simple-blog-template/components/blog/main-content.tsx
+++ b/examples/nextjs-simple-blog-template/components/blog/main-content.tsx
@@ -3,13 +3,13 @@ import { type Renderer, marked } from "marked";
const renderer: Partial = {
paragraph({ tokens }) {
const text = this.parser.parseInline(tokens);
- return `${text}
`;
+ return `${text}
`;
},
link({ href, title, tokens }) {
const text = this.parser.parseInline(tokens);
return `${text}`;
+ }" class="text-white underline hover:opacity-80">${text}`;
},
strong({ tokens }) {
const text = this.parser.parseInline(tokens);
@@ -18,7 +18,7 @@ const renderer: Partial = {
heading({ tokens, depth }) {
const text = this.parser.parseInline(tokens);
const escapedText = text.toLowerCase().replace(/[^\w]+/g, "-");
- return `
+ return `
@@ -26,21 +26,47 @@ const renderer: Partial = {
`;
},
image({ href, title, text }) {
- return `
`;
+ return `
+
+ `;
},
code({ text, lang, escaped }) {
- return `${text}
`;
+ return `
+ ${text}
+
`;
},
codespan({ text }) {
- return `${text}`;
+ return `${text}`;
},
} as Renderer;
+
marked.use({ renderer: renderer, pedantic: false, gfm: true, breaks: true });
export function MainContent({ content }: { content: string }) {
return (
Recent updates
-+
This blog is maintained using NotCMS itself!
+
{page.title}
-+
{page.properties.description}
+
{page.title}
-${text}
`; + return `${text}
`; }, link({ href, title, tokens }) { const text = this.parser.parseInline(tokens); return `${text}`; + }" class="text-white underline hover:opacity-80">${text}`; }, strong({ tokens }) { const text = this.parser.parseInline(tokens); @@ -18,7 +18,7 @@ const renderer: Partial${text}`;
+ return `
+ ${text}
+ `;
},
codespan({ text }) {
- return `${text}`;
+ return `${text}`;
},
} as Renderer;
+
marked.use({ renderer: renderer, pedantic: false, gfm: true, breaks: true });
export function MainContent({ content }: { content: string }) {
return (