Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
itsMapleLeaf committed Dec 11, 2023
2 parents 07ad62d + 60a1ca2 commit 8a62d3b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
16 changes: 8 additions & 8 deletions templates/studio-template-blog/src/pages/blog/[...slug].astro
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
import { Blog, db } from "astro:db"
import { marked } from "marked"
import BlogPost from "../../layouts/BlogPost.astro"
import { Blog, db } from 'astro:db';
import { marked } from 'marked';
import BlogPost from '../../layouts/BlogPost.astro';
export async function getStaticPaths() {
const posts = await db.select().from(Blog)
const posts = await db.select().from(Blog);
return posts.map((post) => ({
params: { slug: post.slug || post.id },
props: { post },
}))
}));
}
type Props = {
post: typeof Blog.$inferSelect
}
const { post } = Astro.props
post: typeof Blog.$inferSelect;
};
const { post } = Astro.props;
---

<BlogPost {...post}>
Expand Down
18 changes: 9 additions & 9 deletions templates/studio-template-blog/src/pages/blog/index.astro
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
import { Blog, db } from "astro:db"
import { asc } from "drizzle-orm"
import BaseHead from "../../components/BaseHead.astro"
import Footer from "../../components/Footer.astro"
import FormattedDate from "../../components/FormattedDate.astro"
import Header from "../../components/Header.astro"
import { SITE_DESCRIPTION, SITE_TITLE } from "../../consts"
import { Blog, db } from 'astro:db';
import { asc } from 'drizzle-orm';
import BaseHead from '../../components/BaseHead.astro';
import Footer from '../../components/Footer.astro';
import FormattedDate from '../../components/FormattedDate.astro';
import Header from '../../components/Header.astro';
import { SITE_DESCRIPTION, SITE_TITLE } from '../../consts';
const posts = await db.select().from(Blog).orderBy(asc(Blog.publishedAt))
const posts = await db.select().from(Blog).orderBy(asc(Blog.publishedAt));
---

<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
Expand Down
2 changes: 1 addition & 1 deletion templates/studio-template-blog/src/pages/rss.xml.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import rss from '@astrojs/rss';
import type { APIContext } from 'astro';
import { Blog, db } from 'astro:db';
import { SITE_DESCRIPTION, SITE_TITLE } from '../consts';
import { Blog, db } from 'astro:db';

export async function GET(context: APIContext) {
const posts = await db.select().from(Blog);
Expand Down
2 changes: 1 addition & 1 deletion templates/studio-template-blog/studio.seed.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Blog, db } from 'astro:db';
import { readFile } from 'node:fs/promises';
import { Blog, db } from 'astro:db';

const lipsum = await readFile(new URL('assets/lipsum.md', import.meta.url), 'utf8');

Expand Down

0 comments on commit 8a62d3b

Please sign in to comment.