Skip to content

Commit c4d42d3

Browse files
committed
fix: show more
1 parent 0c1dc5f commit c4d42d3

File tree

4 files changed

+19
-21
lines changed

4 files changed

+19
-21
lines changed

apps/next-blog/src/app/rss.xml/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// src/pages/api/rss/index.ts
2-
import { generateRssFeed } from '../../utils/generateRSSFeed'
32
import { NextRequest, NextResponse } from 'next/server'
3+
import { generateRssFeed } from '../../utils/generateRSSFeed'
44

55
export const dynamic = 'force-dynamic'
66

77
export async function GET(req: NextRequest) {
88
try {
9-
const type = req.nextUrl.searchParams.get('type') || 'atom'
9+
const type = req.nextUrl.searchParams.get('type') || 'rss'
1010

1111
const typeAsString = Array.isArray(type) ? type[0] : type
1212

apps/next-blog/src/utils/blog.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { cache } from 'react'
2-
import { strapi } from './strapi'
31
import type { BlogPost } from '@/types'
42
import { Attribute } from '@strapi/strapi'
3+
import { cache } from 'react'
54
import { env } from '../env/server.mjs'
5+
import { strapi } from './strapi'
66

77
type StrapiResponse = {
88
data:
@@ -148,7 +148,7 @@ export const getAllPosts = async (draftMode = false) => {
148148
const data = await fetch(
149149
`${
150150
env.STRAPI_ENDPOINT
151-
}/blog-posts?fields[0]=title&fields[1]=slug&fields[2]=publishDate&fields[3]=publishedAt&fields[4]=doi&fields[5]=excerpt&fields[6]=id&fields[7]=updatedAt&populate[blog_authors][populate]=&populate[blog_tags][populate]=&populate[team_members][populate]=&populate[image][populate]=&populate[category][populate]=&sort[0]=publishDate%3Adesc&sort[1]=publishedAt%3Adesc${
151+
}/blog-posts?fields[0]=title&fields[1]=slug&fields[2]=publishDate&fields[3]=publishedAt&fields[4]=doi&fields[5]=excerpt&fields[6]=id&fields[7]=updatedAt&populate[blog_authors][populate]=&populate[blog_tags][populate]=&populate[team_members][populate]=&populate[image][populate]=&populate[category][populate]=&sort[0]=publishDate%3Adesc&sort[1]=publishedAt%3Adesc&pagination[pageSize]=1000${
152152
draftMode ? '&publicationState=preview' : ''
153153
}`,
154154
{

apps/next-blog/src/utils/generateRSSFeed.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,32 @@ import { getAllPosts } from './blog'
33

44
export async function generateRssFeed(type: 'rss' | 'atom' | 'json' = 'rss') {
55
const allPosts = (await getAllPosts()) ?? []
6-
const site_url = process.env.VERCEL ? 'https://trialanderror.org' : 'http://localhost:4200'
6+
console.log(allPosts, allPosts.length)
7+
// const site_url = process.env.VERCEL ? 'https://blog.trialanderror.org' : 'http://localhost:4200'
8+
const site_url = 'https://blog.trialanderror.org'
79

810
const feedOptions: FeedOptions = {
911
updated: new Date(),
1012
language: 'en',
1113
author: {
12-
name: 'Center of Trial & Error',
14+
name: 'Blog of Center of Trial & Error',
1315
email: 'info@trialanderror.org',
14-
link: 'https://trialanderror.org',
16+
link: 'https://blog.trialanderror.org',
1517
},
1618
ttl: 60 * 60,
17-
title: 'Center of Trial & Error | RSS Feed',
18-
description: 'Updates from the Blog, Journal, and Center of Trial & Error!',
19+
title: 'Blog of Center of Trial & Error | RSS Feed',
20+
description: 'Updates from the Blog of Trial & Error!',
1921
id: site_url,
2022
link: site_url,
2123
image: `${site_url}/android-chrome-384x384.png`,
2224
favicon: `${site_url}/favicon.ico`,
2325
copyright: `CC-BY 4.0 ${new Date().getFullYear()}, Center of Trial & Error`,
2426
generator: 'Feed for Node.js',
2527
feedLinks: {
26-
rss2: `/rss2.xml`,
27-
// other feed formats
28-
json: `/rss.json`,
29-
atom: `/rss.xml`,
28+
rss2: `/rss.xml`,
29+
// // other feed formats
30+
// json: `/rss.json`,
31+
// atom: `/rss.xml`,
3032
},
3133
}
3234

@@ -55,6 +57,7 @@ export async function generateRssFeed(type: 'rss' | 'atom' | 'json' = 'rss') {
5557
description: post.excerpt,
5658
guid: post.slug,
5759
content: url,
60+
// image: post.image?.formats?.thumbnail?.url ?? post.image.url,
5861
category: [
5962
{
6063
term: post.category?.title,
@@ -63,6 +66,7 @@ export async function generateRssFeed(type: 'rss' | 'atom' | 'json' = 'rss') {
6366
term: tag.title,
6467
})) ?? []),
6568
],
69+
// image: 'https://google.com',
6670
...(image
6771
? {
6872
image,

package.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,6 @@
170170
"url-loader": "^4.1.1",
171171
"webpack-cli": "^5.0.2"
172172
},
173-
"packageManager": "yarn@1.22.1",
174173
"repository": "https://github.com/TrialAndErrorOrg/websites",
175-
"author": "Thomas F. K. Jorna <hello@tefkah.com>",
176-
"pnpm": {
177-
"patchedDependencies": {
178-
"@headlessui/react@1.7.8": "patches/@headlessui__react@1.7.8.patch"
179-
}
180-
}
174+
"author": "Thomas F. K. Jorna <hello@tefkah.com>"
181175
}

0 commit comments

Comments
 (0)