File tree Expand file tree Collapse file tree 5 files changed +116
-9
lines changed Expand file tree Collapse file tree 5 files changed +116
-9
lines changed Original file line number Diff line number Diff line change 1313 "@astrojs/check" : " ^0.9.4" ,
1414 "@astrojs/markdown-remark" : " ^6.3.7" ,
1515 "@astrojs/react" : " ^4.4.0" ,
16- "@astropub/md" : " ^1.0.0" ,
1716 "@cospired/i18n-iso-languages" : " ^4.2.0" ,
1817 "@iconify-json/bi" : " ^1.2.6" ,
1918 "@iconify-json/ph" : " ^1.2.2" ,
2625 "marked" : " ^16.3.0" ,
2726 "prettier" : " ^3.6.2" ,
2827 "prettier-plugin-astro" : " ^0.14.1" ,
28+ "rss-parser" : " ^3.13.0" ,
2929 "sass" : " ^1.93.2" ,
3030 "typescript" : " ^5.9.2"
3131 },
Original file line number Diff line number Diff line change 1+ ---
2+ import { identity } from " lodash-es" ;
3+ import Parser from " rss-parser" ;
4+
5+ const feedUrl = " https://gephi.wordpress.com/feed/" ;
6+
7+ const parser = new Parser <{ [key : string ]: any }, { " media:thumbnail" ? : { $: { url: string } } }>({
8+ timeout: 2000 ,
9+ customFields: {
10+ item: [" media:thumbnail" ],
11+ },
12+ });
13+ const feed = await parser .parseURL (feedUrl );
14+
15+ const dateFormatter = new Intl .DateTimeFormat (" en-EN" , { dateStyle: " long" });
16+ ---
17+
18+ <section class =" blog-posts" >
19+ <h2 >Latest posts on Gephi's blog</h2 >
20+ <div class =" d-flex flex-wrap gap-4 w-100" >
21+ {
22+ feed .items .slice (0 , 4 ).map ((item ) => (
23+ <article class = " blog-post" >
24+ { " " }
25+ { item [" media:thumbnail" ] && <img src = { item [" media:thumbnail" ]?.$ .url } />}
26+ <a href = { item .link } >
27+ <h4 >{ item .title } </h4 >
28+ </a >
29+ <div >{ item .contentSnippet } </div >
30+ <div class = " text-end text-muted" >
31+ by{ " " }
32+ { [item .creator , item .pubDate && dateFormatter .format (new Date (item .pubDate ))].filter (identity ).join (" on " )}
33+ </div >
34+ </article >
35+ ))
36+ }
37+ </div >
38+ </section >
Original file line number Diff line number Diff line change 22import { Image } from " astro:assets" ;
33
44import { Icon } from " astro-icon/components" ;
5+ import BlogRSS from " ../components/BlogRSS.astro" ;
56import DownloadGephiDesktop from " ../components/DownloadGephiDesktop.astro" ;
67import Layout from " ../layouts/Layout.astro" ;
78---
@@ -226,5 +227,8 @@ import Layout from "../layouts/Layout.astro";
226227 </div >
227228 </section >
228229 </section >
230+ <section >
231+ <BlogRSS />
232+ </section >
229233 </main >
230234</Layout >
Original file line number Diff line number Diff line change @@ -245,3 +245,28 @@ a.no-decoration {
245245 text-decoration : none ;
246246 color : inherit ;
247247}
248+
249+ .blog-posts {
250+ .blog-post {
251+ width : calc (50% - 1.5rem / 2 );
252+
253+ @include media-breakpoint-down (md) {
254+ width : 100% ;
255+ }
256+
257+ @extend .p-4 ;
258+ @extend .shadow ;
259+ background : #fffffff6 ;
260+ position : relative ;
261+
262+ display : flex ;
263+ flex-direction : column ;
264+ justify-content : space-between ;
265+ row-gap : 0.5rem ;
266+ img {
267+ max-width : 100% ;
268+ max-height : 50% ;
269+ object-fit : contain ;
270+ }
271+ }
272+ }
You can’t perform that action at this time.
0 commit comments