Skip to content

Commit

Permalink
no blog liit
Browse files Browse the repository at this point in the history
  • Loading branch information
lassejaco committed Jun 19, 2024
1 parent baf959c commit b4929ef
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion devcon/src/pages/blogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default pageHOC(function BlogsTemplate(props: any) {
<PageHero heroBackground={HeroBackground} />

<div className="section">
<BlogOverview maxItems={10} blogs={props.blogs} />
<BlogOverview blogs={props.blogs} />
{/* <Tags items={pageContext?.current?.tags} viewOnly /> */}
</div>
</Page>
Expand Down
56 changes: 28 additions & 28 deletions devcon/src/services/blogs.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
import Parser from "rss-parser"
import slugify from "slugify"
import { BlogPost } from "types/BlogPost"
import Parser from 'rss-parser'
import slugify from 'slugify'
import { BlogPost } from 'types/BlogPost'

const defaultMaxItems = 6
const defaultMaxItems = 1000000

export async function GetBlogs(maxItems: number = defaultMaxItems): Promise<Array<BlogPost>> {
const parser: Parser = new Parser({
customFields: {
item: ['description'],
}
})
const parser: Parser = new Parser({
customFields: {
item: ['description'],
},
})

const feed = await parser.parseURL('https://blog.ethereum.org/en/events/feed.xml')
const blogs = feed.items
.filter(i => i.categories?.some(category => category === 'Devcon'))
.map(i => {
const isManual = slugify(i.title ?? '') === 'The-Devcon-VI-Manual'
const feed = await parser.parseURL('https://blog.ethereum.org/en/events/feed.xml')
const blogs = feed.items
.filter(i => i.categories?.some(category => category === 'Devcon'))
.map(i => {
const isManual = slugify(i.title ?? '') === 'The-Devcon-VI-Manual'

return {
id: slugify(i.title ?? ''),
title: i.title,
description: i.description,
date: i.pubDate ? new Date(i.pubDate).getTime() : 0,
author: 'Devcon Team',
body: i['content:encoded'] || i.description,
slug: slugify(i.title ?? ''),
permaLink: i.link,
imageUrl: isManual ? '/assets/images/manual.webp' : i.enclosure ? i['enclosure'].url : '',
} as BlogPost
})
return {
id: slugify(i.title ?? ''),
title: i.title,
description: i.description,
date: i.pubDate ? new Date(i.pubDate).getTime() : 0,
author: 'Devcon Team',
body: i['content:encoded'] || i.description,
slug: slugify(i.title ?? ''),
permaLink: i.link,
imageUrl: isManual ? '/assets/images/manual.webp' : i.enclosure ? i['enclosure'].url : '',
} as BlogPost
})

return blogs.slice(0, maxItems)
}
return blogs.slice(0, maxItems)
}

0 comments on commit b4929ef

Please sign in to comment.