

- #Javascript rss feed reader how to
- #Javascript rss feed reader install
- #Javascript rss feed reader software
RSS feeds are coded in XML (eXtended Markup Language) – a language somewhat related to its more popular sibling HTML with the exception that XML lacks styling data.
#Javascript rss feed reader how to
There you have it! Dynamically reading blog articles, building HTML from the data and printing the HTML to the page.Back to knowledge base The 5 most common RSS feed problems and how to fix them Since the for loop on line 4 is programmed to repeat three times, three articles are printed to the blog section. Line 23 finds the blog section in the HTML page, then line 24 adds our article to it. The next line appends that link to the we created on line 11, resulting in this: Post Title

This means we are putting the tag inside our link, resulting in this: Post Title Line 20 appends the element we created to the tag we created. We need to put this all together into a functioning set of HTML before appending to the page. Lines 17 to 18 create a new tag using the title of the post as the content. Lines 13 to 15 create a new tag using the URL of the post as the href. Line 11 creates a new HTML tag in memory. Javascript is powerful because it enables us to dynamically alter the state of a static web page That means we can write HTML, but we can also write Javascript which can alter that HTML with new data. The data from the first 3 articles get sent to a function called printPost(), defined on line 10. The loop on line 4 is what we use to print the articles to the page. Otherwise, continue on as if all is well. Line 3 states that if the function did return an error, then our function should throw an error since something has gone wrong. The lines 3 to 7 contain the function that we get to write once parseUrl() has retrieved the data and has given us the err and feed results.

Line 2 is using the parseURL() function from that library to read our feed. This is what we just imported from the library we downloaded. Line 1 shows us initializing a new RSSParser object.
#Javascript rss feed reader install
If your site is a Node project, you can install it using npm by running npm install -save rss-parser, but if you’re just using a basic HTML & Javascript setup, you can download the library by navigating here, right-clicking on the “Raw” button and selecting “Save As…”.įigure 1: retrieving and printing the article titles RSS-parser is an NPM module which does this perfectly. Fortunately, many libraries already exist which perform this function. Since we know that RSS is standardised, it follows a set of rules, so we could write a parser which understands the data from the RSS feed and then display that on the page. In the new “Blog” section of my portfolio site, I wanted to display the latest three articles from my Medium profile. The articles you read on Medium can be retrieved via RSS as well as through the browser. It’s most commonly used for news aggregators and blogs, enabling third-party platforms to display blog posts from other platforms.
#Javascript rss feed reader software
RSS is an XML based data stream that is standardised so that software can always understand the data no matter where it comes from, so long as it conforms to RSS standard. These feeds can, for example, allow a user to keep track of many different websites in a single news aggregator.” - Wikipedia “RSS is a web feed that allows users and applications to access updates to websites in a standardized, computer-readable format. Fortunately, Medium provides an RSS feed for each member at the following URL where is your Medium username: is What Is RSS? However, I wanted to display my latest articles from Medium on my page. The usual stuff.Īll of the tutorials and walkthroughs I write are published on Medium. It’s used to expose my development experience, my skills and the projects I’ve worked on over the years. I, like many developers, have a portfolio site which doubles up as a kind of CV/Resume.
