The News Website (index.html)
Relevant source files
The following files were used as context for generating this wiki page:The nodejs-news-feeder project provides a human-readable HTML website, index.html, as a front-end for the aggregated news content. While the primary output of the project is an RSS feed (feed.xml), this website serves as an alternative way for users to consume the latest news directly in their browser. The page is not manually edited; instead, it is dynamically generated by a build script that parses the feed.xml file and renders the content using a template.
This website, titled "cybernews," lists data breach incidents and other cybersecurity news. Each entry includes a title, a short description, a publication date, and a link to the original source for more details.
Sources: README.md, index.html:1-29, scripts/build-website.js
Website Build Process
The index.html file is generated by executing the npm run website:build command. This command runs the scripts/build-website.js script, which orchestrates the entire build process.
Sources: package.json:11
The process involves reading the content of the master feed.xml file, parsing it into a structured format, and then injecting this data into an EJS template (templates/index.html.ejs) to produce the final index.html file.
The following diagram illustrates the build flow:
This diagram shows the sequence of operations when building the website.
Sources: scripts/build-website.js:1-12, utils/index.js:10-11, 145-147, 151-153
Key Scripts and Dependencies
The build process relies on several scripts and npm packages.
| File / Package | Role |
|---|---|
scripts/build-website.js | The main script that orchestrates the website generation. |
utils/index.js | Provides helper functions (getFeedContent, getWebsiteTemplate, overwriteWebsiteContent) to interact with the filesystem. |
package.json | Defines the website:build script and lists ejs and @ulisesgascon/rss-feed-parser as dependencies. |
ejs | A templating engine used to render the HTML page from a template and data. |
@ulisesgascon/rss-feed-parser | A library used to parse the feed.xml content into a JavaScript object. |
Sources: package.json:11, 40, 44, scripts/build-website.js:1-4
The core logic of the build script is as follows:
// scripts/build-website.js:4-12
const template = getWebsiteTemplate()
const feed = getFeedContent()
try{
const { metadata, items } = rssParse(feed)
console .log(items)
const html = ejs.render(template, { metadata, items:items.map((e)=>{
e.link.replace('https://thomas-iniguez-visioli.github.io/nodejs-news-feeder/','')
return e
}) })
overwriteWebsiteContent(html)
}catch(err){console.log(err)}
This snippet shows the script fetching the template and feed, parsing the feed, rendering the HTML with EJS, and writing the result to index.html.
Sources: scripts/build-website.js:4-12
Page Structure
The generated index.html has a clear, semantic structure. It consists of a header, main content area, and a footer.
Sources: index.html
Header (<head>)
The <head> section contains standard metadata for the page, including:
- Character set and viewport settings.
- Page title, which is hardcoded as "cybernews".
- SEO and social media metadata (Open Graph, Twitter Cards).
- A link to the "Source Sans 3" font from Google Fonts.
- Inline CSS for reset and custom styling.
Sources: index.html:4-188
Body (<body>)
The <body> contains the visible content, structured as follows:
<main>: Wraps the primary content..container: Adivthat centers the content and applies padding.- Page Header: An
<h1>with the title "cybernews" and a<p>with the description "fuite de donnée enregistrée". - Latest News Section: An
<h2>titled "Latest News" followed by adiv.feed-items. - Feed Items: Inside
div.feed-items, each news item is rendered as an<article>element.
Sources: index.html:191-203
Article Structure
Each news article within the feed is displayed in a consistent format:
<hr>: A horizontal rule separating articles.<article>: The container for a single news item.<h3>: The title of the news item.- Description: The body of the news item, often containing a paragraph
<p>with details. <p class="feed-time">: The publication date and time.<a class="feed-link">: A "read more" link pointing to the original source of the news.
The following is an example of a rendered article from index.html:
<!-- index.html:206-217 -->
<hr>
<article>
<h3>
Operation Endgame 3.0 - 2,046,030 breached accounts
</h3>
Between 10 and 13 November 2025, <a href="https//www.europol.europa.eu/media-press/newsroom/news/end-of-game-for-cybercrime-infrastructure-1025-servers-taken-down" target="_blank" rel="noopener">the latest phase of Operation Endgame was coordinated from Europol's headquarters in The Hague</a>. The actions targeted one of the biggest infostealer Rhadamanthys, the Remote Access Trojan VenomRAT, and the botnet Elysium, all of which played a key role in international cybercrime. Authorities took down these three large cybercrime enablers and provided 2 million impacted email addresses and 7.4 million passwords to HIBP.</p>
<p class="feed-time">
Thu, 13 Nov 2025 10:23:00 GMT
</p>
<a class="feed-link" href="https//haveibeenpwned.com/Breach/OperationEndgame3">
read more
</a>
</article>
Sources: index.html:206-217
Manual Post Management
For local development and content management, the repository includes a simple Express server and an HTML form to add posts manually. This system allows contributors to add news items that are not automatically collected from other sources.
Sources: server.js, add-post.html
Manual Post Submission Flow
The following sequence diagram illustrates how a user adds a manual post.
This diagram shows the interaction between the user, the Express server, and the manual-posts.json file.
Sources: server.js:8-44, add-post.html:43-73
The server.js file sets up two main API endpoints:
GET /api/posts: Retrieves and returns all posts frommanual-posts.json.POST /api/posts: Receives new post data, adds it tomanual-posts.json, and saves the file.
These manually added posts are then incorporated into the main feed.xml by the scripts/collect-manual-posts.js script, making them available for the website build process.
Sources: scripts/collect-manual-posts.js
Summary
The index.html website is a key user-facing component of the nodejs-news-feeder project. It provides a clean, readable interface for the aggregated news content. Its generation is fully automated via the npm run website:build script, which processes the central feed.xml file. This ensures that the website is always in sync with the latest content from all collected sources, including automated collectors and manual post submissions. The architecture decouples content aggregation from presentation, allowing for a robust and maintainable system.
Sources: README.md, scripts/build-website.js, package.json:11