refactor: remove draft filtering from public routes
This commit is contained in:
parent
aa349ed7c9
commit
828d637c63
6 changed files with 6 additions and 6 deletions
|
|
@ -5,7 +5,7 @@ import { getSlug, enrichPostsWithDates } from '../lib/md';
|
||||||
import { getTxtFiles } from '../lib/txt';
|
import { getTxtFiles } from '../lib/txt';
|
||||||
|
|
||||||
export async function GET(context: APIContext) {
|
export async function GET(context: APIContext) {
|
||||||
const rawPosts = await getCollection('md', ({ data }) => data.draft !== true);
|
const rawPosts = await getCollection('md');
|
||||||
const posts = enrichPostsWithDates(rawPosts);
|
const posts = enrichPostsWithDates(rawPosts);
|
||||||
const bookmarks = await getCollection('bookmarks');
|
const bookmarks = await getCollection('bookmarks');
|
||||||
const txtFiles = getTxtFiles();
|
const txtFiles = getTxtFiles();
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { formatDate, extractDomain, formatListItem } from '../lib/format';
|
||||||
import { organizePostsByCategory, getSlug, enrichPostsWithDates } from '../lib/md';
|
import { organizePostsByCategory, getSlug, enrichPostsWithDates } from '../lib/md';
|
||||||
import { getTxtFiles } from '../lib/txt';
|
import { getTxtFiles } from '../lib/txt';
|
||||||
|
|
||||||
const rawPosts = await getCollection('md', ({ data }) => data.draft !== true);
|
const rawPosts = await getCollection('md');
|
||||||
const posts = enrichPostsWithDates(rawPosts);
|
const posts = enrichPostsWithDates(rawPosts);
|
||||||
const { grouped, categories: sortedCategories } = organizePostsByCategory(posts);
|
const { grouped, categories: sortedCategories } = organizePostsByCategory(posts);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { formatDate, formatListItem } from '../../lib/format';
|
||||||
import { getSlug, enrichPostWithDates, enrichPostsWithDates, resolveRelatedPosts } from '../../lib/md';
|
import { getSlug, enrichPostWithDates, enrichPostsWithDates, resolveRelatedPosts } from '../../lib/md';
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const rawPosts = await getCollection('md', ({ data }) => data.draft !== true);
|
const rawPosts = await getCollection('md');
|
||||||
const allPosts = enrichPostsWithDates(rawPosts);
|
const allPosts = enrichPostsWithDates(rawPosts);
|
||||||
return allPosts.map(post => ({
|
return allPosts.map(post => ({
|
||||||
params: { slug: getSlug(post.id) },
|
params: { slug: getSlug(post.id) },
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import Layout from '../../layouts/Layout.astro';
|
||||||
import { formatListItem } from '../../lib/format';
|
import { formatListItem } from '../../lib/format';
|
||||||
import { organizePostsByCategory, getSlug, enrichPostsWithDates } from '../../lib/md';
|
import { organizePostsByCategory, getSlug, enrichPostsWithDates } from '../../lib/md';
|
||||||
|
|
||||||
const rawPosts = await getCollection('md', ({ data }) => data.draft !== true);
|
const rawPosts = await getCollection('md');
|
||||||
const posts = enrichPostsWithDates(rawPosts);
|
const posts = enrichPostsWithDates(rawPosts);
|
||||||
const { grouped, categories: sortedCategories } = organizePostsByCategory(posts);
|
const { grouped, categories: sortedCategories } = organizePostsByCategory(posts);
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ export const prerender = false;
|
||||||
|
|
||||||
export async function GET(context: APIContext) {
|
export async function GET(context: APIContext) {
|
||||||
const site = context.site?.origin ?? 'https://wynne.rs';
|
const site = context.site?.origin ?? 'https://wynne.rs';
|
||||||
const posts = await getCollection('md', ({ data }) => data.draft !== true);
|
const posts = await getCollection('md');
|
||||||
const bookmarks = await getCollection('bookmarks');
|
const bookmarks = await getCollection('bookmarks');
|
||||||
const txtFiles = getTxtFileNames();
|
const txtFiles = getTxtFileNames();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ const SUBDOMAINS = [
|
||||||
|
|
||||||
export async function GET(context: APIContext) {
|
export async function GET(context: APIContext) {
|
||||||
const site = context.site?.origin ?? 'https://wynne.rs';
|
const site = context.site?.origin ?? 'https://wynne.rs';
|
||||||
const posts = await getCollection('md', ({ data }) => data.draft !== true);
|
const posts = await getCollection('md');
|
||||||
const txtFiles = getTxtFileNames();
|
const txtFiles = getTxtFileNames();
|
||||||
|
|
||||||
const urls = [
|
const urls = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue