Skip to content

Commit 3b2a3e5

Browse files
authored
Merge pull request #2018 from appwrite/filter-unlisted-posts-in-read-next
fix: filter unlisted posts in read next
2 parents e222ce7 + 9ffa6ee commit 3b2a3e5

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

src/markdoc/layouts/Post.svelte

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
<script lang="ts">
2+
import { page } from '$app/state';
23
import { Media } from '$lib/UI';
34
import { FooterNav, MainFooter } from '$lib/components';
5+
import CTA from '$lib/components/BlogCta.svelte';
6+
import Article from '$lib/components/blog/article.svelte';
7+
import Breadcrumbs from '$lib/components/blog/breadcrumbs.svelte';
8+
import Newsletter from '$lib/components/blog/newsletter.svelte';
9+
import PostMeta from '$lib/components/blog/post-meta.svelte';
10+
import TableOfContents from '$lib/components/blog/table-of-contents.svelte';
411
import { Main } from '$lib/layouts';
12+
import type { TocItem } from '$lib/layouts/DocsArticle.svelte';
513
import { formatDate } from '$lib/utils/date';
614
import {
715
createBreadcrumbsSchema,
@@ -12,14 +20,6 @@
1220
import type { AuthorData, PostsData } from '$routes/blog/content';
1321
import { TITLE_SUFFIX } from '$routes/titles';
1422
import { getContext, setContext } from 'svelte';
15-
import { page } from '$app/state';
16-
import CTA from '$lib/components/BlogCta.svelte';
17-
import PostMeta from '$lib/components/blog/post-meta.svelte';
18-
import Breadcrumbs from '$lib/components/blog/breadcrumbs.svelte';
19-
import Newsletter from '$lib/components/blog/newsletter.svelte';
20-
import TableOfContents from '$lib/components/blog/table-of-contents.svelte';
21-
import Article from '$lib/components/blog/article.svelte';
22-
import type { TocItem } from '$lib/layouts/DocsArticle.svelte';
2323
import { writable } from 'svelte/store';
2424
import type { LayoutContext } from './Article.svelte';
2525
@@ -39,7 +39,9 @@
3939
| boolean;
4040
export let lastUpdated: string;
4141
42-
const posts = getContext<PostsData[]>('posts');
42+
const posts = getContext<PostsData[]>('posts')?.filter(
43+
(post) => !(post.unlisted ?? false) && !(post.draft ?? false)
44+
);
4345
const authors = getContext<AuthorData[]>('authors');
4446
const authorData = authors.find((a) => a.slug === author);
4547

src/routes/blog/[[page]]/+page.svelte

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<script lang="ts">
2-
import { tick } from 'svelte';
3-
import { page } from '$app/state';
4-
import { Main } from '$lib/layouts';
5-
import { TITLE_SUFFIX } from '$routes/titles';
6-
import { DEFAULT_HOST } from '$lib/utils/metadata';
7-
import { createDebounce } from '$lib/utils/debounce';
82
import { goto, onNavigate } from '$app/navigation';
3+
import { page } from '$app/state';
94
import { Article, FooterNav, MainFooter } from '$lib/components';
105
import { Button } from '$lib/components/ui';
6+
import { Main } from '$lib/layouts';
7+
import { createDebounce } from '$lib/utils/debounce';
8+
import { DEFAULT_HOST } from '$lib/utils/metadata';
9+
import { TITLE_SUFFIX } from '$routes/titles';
10+
import { tick } from 'svelte';
1111
1212
let { data } = $props();
1313

0 commit comments

Comments
 (0)