diff options
| author | Pinapelz <yukais@pinapelz.com> | 2024-02-10 13:15:02 -0800 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2024-02-10 13:15:02 -0800 |
| commit | 9046f5cc95289eb6e5a9e93e2da8a4eda74cb5ff (patch) | |
| tree | 32e98b39e0b97099f0b2c39b6826efd2db9532cd /src/components/RSSFeed.astro | |
| parent | 97e737d62497a9764b88386fa06c6263937675c4 (diff) | |
refactored some components
- added DiscordStatus to about
- Updated projects
- Added tags to each project
- Fixed some text styling
Diffstat (limited to 'src/components/RSSFeed.astro')
| -rw-r--r-- | src/components/RSSFeed.astro | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/src/components/RSSFeed.astro b/src/components/RSSFeed.astro deleted file mode 100644 index ca2dddb..0000000 --- a/src/components/RSSFeed.astro +++ /dev/null @@ -1,73 +0,0 @@ ---- -import { JSDOM } from 'jsdom'; - -const fetchContent = async (url) => { - try { - const response = await fetch(url); - if (!response.ok) { - throw new Error(`Failed to fetch RSS feed: ${response.statusText}`); - } - return await response.text(); - } catch (error) { - console.error(error); - return '<rss></rss>'; - } -}; - -const rssData = await fetchContent(Astro.props.url); - -// Parse the RSS data -const dom = new JSDOM(rssData); -const xmlDoc = dom.window.document; -const items = Array.from(xmlDoc.querySelectorAll("item")).slice(0, 7); // Only take the first 5 items - -const title = xmlDoc.querySelector("title").textContent; -const link = xmlDoc.querySelector("link").textContent; -const description = xmlDoc.querySelector("description").textContent; ---- - -<style> - body { - font-family: Arial, sans-serif; - } - header { - padding: 20px; - margin-bottom: 20px; - border-radius: 8px; - } - ul { - list-style-type: none; - padding: 0; - } - li { - border-bottom: 1px solid #444; - padding: 10px 0; - transition: background-color 0.3s; - } - li:hover { - background-color: #3a3a3a; - } - a { - color: #f9a825; - text-decoration: none; - } - a:hover { - text-decoration: underline; - } - time { - color: #888; - font-size: 0.85em; - } -</style> - -<ul> - {items.map(item => { - return ( - <li key={item.querySelector("guid").textContent}> - <a href={item.querySelector("guid").textContent}>{item.querySelector("title").textContent}</a> - <p>{item.querySelector("description").textContent}</p> - <time>{item.querySelector("pubDate").textContent}</time> - </li> - ); - })} -</ul> |
