Skip to content

Commit

Permalink
fix rss.xml file generation
Browse files Browse the repository at this point in the history
  • Loading branch information
zag committed Dec 18, 2024
1 parent ea6c315 commit c2cdf39
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
=head1 Upcoming
=head1 0.2.3
=item fix rss.xml file generation
=head1 0.2.2
=item average page size optimization (reduction up to 2-3 times)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "podlite-web",
"description": "📖 Create static websites with Next.js and the Podlite markup language.",
"version": "0.2.2",
"version": "0.2.3",
"private": true,
"scripts": {
"next_dev": "next dev",
Expand Down
9 changes: 4 additions & 5 deletions src/utils/rss.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { DataFeedContent } from '../../bin/makeDataSource'
import { DATA_PATH, PUBLIC_PATH } from '../constants'
import { PUBLIC_PATH } from '../constants'
import { getSiteInfo } from '../utils'
import * as fs from 'fs'
import { convertPodNodeToHtml as convertPodNodeToHtml } from '../utils'
import { getData } from 'src/serverside'
import { getAllPages } from 'src/serverside'

export function getRssForData(data: DataFeedContent) {
const conf = data.siteInfo
Expand Down Expand Up @@ -35,8 +35,7 @@ ${pages
`
}
export function writeRss() {
const dataFeed = getData()
const pages = dataFeed.all
const pages = getAllPages()
.filter(a => a.pubdate)
.filter(page => page.description)
.sort((a, b) => {
Expand All @@ -46,6 +45,6 @@ export function writeRss() {
.reverse()
.splice(0, 10)
//@ts-ignore
const rss = getRssForData({ ...dataFeed, all: pages, siteInfo: getSiteInfo() })
const rss = getRssForData({ all: pages, siteInfo: getSiteInfo() })
fs.writeFileSync(`${PUBLIC_PATH}/rss.xml`, rss)
}

0 comments on commit c2cdf39

Please sign in to comment.