Skip to content

Commit

Permalink
fix rss feed, remove redundant check
Browse files Browse the repository at this point in the history
  • Loading branch information
nemanjam committed Jun 22, 2024
1 parent 87e5a0a commit ce759ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .env.production.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ SITE_URL=https://nemanjam.github.io

# see draft posts and projects, true | false | empty
# optional, default false, set only on prod build
# PREVIEW_MODE=
PREVIEW_MODE=
8 changes: 2 additions & 6 deletions src/libs/api/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,12 @@ export const getFeed = async (): Promise<Feed> => {
author,
});

// this handles omitting draft posts and preview mode by default
const sortedPosts = await getAllPosts();

for (const post of sortedPosts) {
const { data, body, slug } = post;
const { title, description, publishDate, heroImage, noHero, draft } = data;

const includeDrafts = isPreviewMode() && draft;

// omit drafts
if (!includeDrafts) continue;
const { title, description, publishDate, heroImage, noHero } = data;

const url = `${SITE_URL}${ROUTES.BLOG}${slug}/`;
const { code: content } = await renderMarkdown(body);
Expand Down

0 comments on commit ce759ae

Please sign in to comment.