Skip to content

Commit

Permalink
feat(site): publish/unpublished posts
Browse files Browse the repository at this point in the history
  • Loading branch information
cor committed Sep 27, 2023
1 parent da0b6bc commit 8b2304a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions site/src/mdsvex/BlogLayout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
export let date;
export let author;
export let preview;
export let published
</script>

<main
class="blog-post-container sm:text-xl p-4 sm:mt-4 justify-center max-w-2xl justify-center self-center"
>
{#if published}
<h1 class="text-3xl sm:text-5xl font-bold mb-0">{title}</h1>
<div class="font-mono mb-2 mt-1 sm:text-lg"
>{date} - <a class="text-accent" href={`https://x.com/${author}`}>{author}</a></div
>
<slot />
{/if}
</main>
6 changes: 4 additions & 2 deletions site/src/routes/blog/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script lang="ts">
type PostMeta = { metadata: { title: string, date: string, author: string, preview: string }};
type PostMeta = { metadata: { title: string, date: string, author: string, preview: string, published: bool }};
const posts: Record<string, PostMeta> = import.meta.globEager('../**/*.md');
const filteredPosts = Object.entries(posts)
.filter(([_path, post], _) => post.metadata.published);
const slugRegex = /\/([^/]+)\//;
function extractSlug(path: string): string {
Expand All @@ -15,7 +17,7 @@

<main class="flex flex-1 justify-center sm:mt-4 ">
<div class="flex flex-col gap-4 max-w-2xl">
{#each Object.entries(posts) as [path, {metadata}] }
{#each filteredPosts as [path, {metadata}] }
<a class="block p-4" href={extractSlug(path)}>
<h1 class="text-3xl sm:text-5xl font-bold mb-0">{metadata.title}</h1>
<div class="font-mono mb-2 mt-1 sm:text-lg">{metadata.date} - <a class="text-accent" href={`https://x.com/${metadata.author}`}>{metadata.author}</a></div>
Expand Down
1 change: 1 addition & 0 deletions site/src/routes/blog/the-journey-so-far/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: The Journey So Far
date: "2023-09-27"
author: "@union_build"
preview: "Today, we are happy to announce the work we have done so far on Union, the trustless infrastructure layer. Over the last six months, unionlabs was founded with nothing but an idea, a diverse skillset, and a mission to ship zkp powered infra everywhere."
published: true
---

Today, we are happy to announce the work we have done so far on Union, the trustless infrastructure layer. Over the last six months, Unionlabs was founded with nothing but an idea, a diverse skillset, and a mission to ship zero-knowledge proof infra everywhere.
Expand Down

0 comments on commit 8b2304a

Please sign in to comment.