diff --git a/src/lib/components/Newsletter.svelte b/src/lib/components/Newsletter.svelte new file mode 100644 index 0000000000..cf7d4f4137 --- /dev/null +++ b/src/lib/components/Newsletter.svelte @@ -0,0 +1,36 @@ + + + + +
+
+
+
Subscribe to our newsletter
+

+ Sign up to our company blog and get the latest insights from Appwrite. Learn more about + engineering, product design, building community, and tips & tricks for using Appwrite. +

+
+ + +
+
+
+
+ + diff --git a/src/lib/components/index.ts b/src/lib/components/index.ts index 60739ec1c8..e49546e66a 100644 --- a/src/lib/components/index.ts +++ b/src/lib/components/index.ts @@ -3,4 +3,5 @@ export { default as MainFooter } from './MainFooter.svelte'; export { default as PreFooter } from './PreFooter.svelte'; export { default as MobileNav } from './MobileNav.svelte'; export { default as Phone } from './Phone.svelte'; +export { default as Newsletter } from './Newsletter.svelte'; export { default as Tooltip } from './Tooltip.svelte'; diff --git a/src/markdoc/layouts/Author.svelte b/src/markdoc/layouts/Author.svelte new file mode 100644 index 0000000000..9427c9de8e --- /dev/null +++ b/src/markdoc/layouts/Author.svelte @@ -0,0 +1,310 @@ + + + + +
+
+
+ + + + + + + + + + + + + + + + +
+ +
+
+
+ {#if avatar} +
+ {name} +
+ {/if} +

{name}

+ {#if role} +
{role}
+ {/if} + {#if bio} + + {/if} +
    + {#if github} +
  • + + +
  • + {/if} + {#if twitter} +
  • + + +
  • + {/if} + {#if linkedin} +
  • + + +
  • + {/if} +
+
+
+
+
+ +
+
+
+

Articles

+ + + + + + + +
+
+ +
+
+
+
+
+
+ + +
+
+
diff --git a/src/markdoc/layouts/Category.svelte b/src/markdoc/layouts/Category.svelte new file mode 100644 index 0000000000..6adfe40797 --- /dev/null +++ b/src/markdoc/layouts/Category.svelte @@ -0,0 +1,93 @@ + + + + +
+
+
+
+ + +
+
+

{name}

+

+ {description} +

+
+ +
+ +
+ +
+
+
+ + +
+
+
+
+
diff --git a/src/markdoc/layouts/Post.svelte b/src/markdoc/layouts/Post.svelte new file mode 100644 index 0000000000..1263b7ae44 --- /dev/null +++ b/src/markdoc/layouts/Post.svelte @@ -0,0 +1,208 @@ + + + + +
+
+
+
+
+
+ + {#if categories?.length} +
+ {#each categories as cat} + {cat.name} + {/each} +
+ {/if} +
+
+
+
+
+ +
+
+
+

Read next

+
+ +
+
+
+
+ +
+
+ + + +
+
+
diff --git a/src/routes/blog/+layout.svelte b/src/routes/blog/+layout.svelte new file mode 100644 index 0000000000..c8629bf17c --- /dev/null +++ b/src/routes/blog/+layout.svelte @@ -0,0 +1,13 @@ + + + diff --git a/src/routes/blog/+layout.ts b/src/routes/blog/+layout.ts new file mode 100644 index 0000000000..0e6cbd085b --- /dev/null +++ b/src/routes/blog/+layout.ts @@ -0,0 +1,74 @@ +import { base } from '$app/paths'; +import type { AuthorData } from '$markdoc/layouts/Author.svelte'; +import type { CategoryData } from '$markdoc/layouts/Category.svelte'; +import type { PostsData } from '$markdoc/layouts/Post.svelte'; + +export function load() { + const postsGlob = import.meta.glob('./post/**/*.markdoc', { + eager: true + }); + const authorsGlob = import.meta.glob('./author/**/*.markdoc', { + eager: true + }); + const categoriesGlob = import.meta.glob('./category/**/*.markdoc', { + eager: true + }); + + const posts = Object.entries(postsGlob) + .map(([filepath, postList]) => { + const { frontmatter } = postList as { + frontmatter: PostsData; + }; + const slug = filepath.replace('./', '').replace('/+page.markdoc', ''); + const postName = slug.slice(slug.lastIndexOf('/') + 1); + + return { + title: frontmatter.title, + description: frontmatter.description, + date: new Date(frontmatter.date), + cover: frontmatter.cover, + timeToRead: frontmatter.timeToRead, + author: frontmatter.author, + category: frontmatter.category, + href: `${base}/blog/post/${postName}` + }; + }) + .sort((a, b) => { + return b.date.getTime() - a.date.getTime(); + }); + + const authors = Object.entries(authorsGlob).map(([_filepath, authorList]) => { + const { frontmatter } = authorList as { + frontmatter: AuthorData; + }; + + return { + name: frontmatter.name, + role: frontmatter.role, + avatar: frontmatter.avatar, + bio: frontmatter.bio, + twitter: frontmatter.twitter, + linkedin: frontmatter.linkedin, + github: frontmatter.github, + href: `${base}/blog/author/${frontmatter.name.toLowerCase()}` + }; + }); + + const categories = Object.entries(categoriesGlob).map(([_filepath, categoryList]) => { + const { frontmatter } = categoryList as { + frontmatter: CategoryData; + }; + + return { + name: frontmatter.name, + description: frontmatter.description, + href: `${base}/blog/category/${frontmatter.name.toLowerCase()}` + }; + }); + + return { + posts, + authors, + categories + }; +} diff --git a/src/routes/blog/+page.svelte b/src/routes/blog/+page.svelte index e33fde606d..e793be84f1 100644 --- a/src/routes/blog/+page.svelte +++ b/src/routes/blog/+page.svelte @@ -128,7 +128,7 @@

Articles

-
+
    {#each data.posts as post} - {@const href = `/blog/article/${post.slug}`} + {@const author = data.authors.find( + (author) => author.name.toLowerCase() === post.author.toLowerCase() + )}
  • - +
    - +

    @@ -244,14 +246,13 @@
    -

    Author's name

    -

    Author's role or bio

    +

    {author?.name}