From ab074d33e32513aee9faf370968a67b74a6d1494 Mon Sep 17 00:00:00 2001 From: Xander Bazzi Date: Tue, 12 Mar 2024 20:18:14 -0600 Subject: [PATCH] Added RSS feed. --- assets/scripts/rss.js | 41 +++++++++++++++++++++++++++++++++++++++++ assets/style/style.css | 4 +++- changelog.md | 3 +++ homenetwork.html | 41 +++++++++++++++++++++++++++++++++-------- index.html | 15 ++++++++++++--- 5 files changed, 92 insertions(+), 12 deletions(-) create mode 100644 assets/scripts/rss.js diff --git a/assets/scripts/rss.js b/assets/scripts/rss.js new file mode 100644 index 0000000..d5fd797 --- /dev/null +++ b/assets/scripts/rss.js @@ -0,0 +1,41 @@ +async function fetchRSSFeed(url) { + try { + const response = await fetch(url); + const data = await response.text(); + return data; + } catch (error) { + console.error("Failed to fetch RSS feed:", error); + return null; + } +} + +function parseRSSFeed(feedXML) { + const parser = new DOMParser(); + const xmlDoc = parser.parseFromString(feedXML, "text/xml"); + const items = xmlDoc.querySelectorAll("item"); + let html = ""; + return html; +} + +async function displayRSSFeed() { + const url = "https://tldr.tech/api/rss/tech"; //https://www.nist.gov/news-events/cybersecurity/rss.xml + const rssData = await fetchRSSFeed(url); + + if (rssData) { + const feedHTML = parseRSSFeed(rssData); + document.getElementById("rss-feed").innerHTML = feedHTML; + } else { + document.getElementById("rss-feed").innerHTML = "Failed to load RSS feed."; + } +} + +displayRSSFeed(); \ No newline at end of file diff --git a/assets/style/style.css b/assets/style/style.css index 47a81a9..7d96ef3 100644 --- a/assets/style/style.css +++ b/assets/style/style.css @@ -35,7 +35,9 @@ body { background-attachment: scroll; z-index: 1; } - +ul { + padding-inline-start: 5px; +} .email-link { position: absolute; top: 10px; /* Adjust the position as needed */ diff --git a/changelog.md b/changelog.md index 7c982ee..daeca8c 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,9 @@ All notable changes to this site will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the versioning is consistent with [Semantic Versioning](https://semver.org/). +## [0.3.0] - 2024-03-12 +### Added +- RSS Feed to tl;dr tech news. ## [0.2.0] - 2024-03-12 ### Added diff --git a/homenetwork.html b/homenetwork.html index 0a65138..a9f5bbd 100644 --- a/homenetwork.html +++ b/homenetwork.html @@ -72,16 +72,41 @@ + + diff --git a/index.html b/index.html index b0fc14f..a4171d6 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,8 @@ - + + @@ -34,8 +35,9 @@

12/05/2023: Finished the home datacenter project.

-
projects
-
+ +
projects
+ + +