Salta al contenuto principale
  1. Posts/

Opml to Html converter

· 2 minuti·

Yesterday I discovered that wordpress does not have a blogroll feature any more so I looked around to find a way to show my feedly subscription list in my blog.

I didn’t find anything interesting so decided to implement a simple javascipt class to convert the opml file exported from feedly to an html page so that I could easily create a wordpress page or widget.

The script is really very simple, it takes the ompl, deserialize it and create a corresponding HTML string using from a basic template defined in the JS itself. It can be certainly improved (for example adding some css class to the template for graphical customization) but, for now, it just work for my needs.

In this version you can customize the export style editing the first lines of the JS:

this.export_template = '<html><title>Opml export</title><body>{INNERHTML}</body></html>';

this.html_template = '<h1>{OPMLTITLE}</h1>n<ul>{ITEMS}</ul>';

this.rss_template = '<li>[<a href="{XMLURL}">RSS</a>] <a href="{HTMLURL}">{TITLE}</a></li>n';

this.folder_template_start = '<li>{TITLE}n<ul>n';

this.folder_template_end = '</ul></li>n';

These variables describe the export format:

  • export_template is the template for the export html page;
  • html_template is the template for the page content;
  • rss_template is the template for each RSS line;
  • folder_template_start is the template for the opening tag of RSS folder line;
  • folder_template_end is the template for the closing tag of RSS folder line.

You can find it on ghitub, under my script repository: opml.js and opml.html.

I hope it can be useful.