Recently I created a proof of concept of publishing book lists, what I’ve read, what I plan to read etc., using OPML. Andy Sylvester picked it up and created his own list, as a way of experimenting with federated bookshelves. He used the XSLT style sheet I created to be able to render the OPML file in a human readable way in your browser. It seems to work, although it doesn’t render in the browser yet.

Andy, I think the reason it doesn’t render in the browser is because you are loading the style sheet from my domain. The XSLT file must be hosted on the same domain as the OPML file, otherwise it triggers cross-site scripting protections. It should work properly if you download the XSLT I use and put it on your own host.

Hosting the XSLT style sheet also allows you to adapt one other detail: right now there are some tweaks in my version based on the author name of a collection or feed. If it is my name it renders as ‘my list’ and otherwise as ‘list I follow’. When you self host the style sheet you can change the mentions of my name to yours and it will make the proper distinction between your lists and lists you follow.

10 reactions on “Andy Tries Out My OPML Book Lists

  1. @JohnPhilpin thank you, yes, doing it this way was an evolution of already exposing my opml list of rss subscriptions in machine and human readable form simultaneously, turning that OPML list into my blogroll as well.

  2. Ton gave me a suggestion to refer to the XSL file on my local domain. I did this, but still only saw the raw OPML appear. After some thinking, I thought about MIME types, and wondered if this was set up on my web hosting to serve OPML as XML. I uploaded a copy of the file with a .xml extension, and everything worked! I have found some resources for updating MIME types, will post later after some experimenting.

  3. After reviewing a Selfoss issue on Github which described the behavior I saw in my first post on this topic:

    This depends on the mime-detection on your server. You need to map .opml to the right mime-type
    application/xml
    in your webserver.

    and this MDN page on updating mime types:

    If you’re using the Apache web server, check the Media Types and Character Encodings section of Apache Configuration: .htaccess for examples of different document types and their corresponding MIME types.

    I decided to look at my own web hosting to see if I could find and modify the .htaccess file. For Bluehost, there is an .htaccess file within the public_html folder. I thought I would start with this one and see how things went.
    Looking at this example configuration file for media types from HTML5 Boilerplate project, I saw this:

    AddType application/xml xml

    I then added this line to my .htaccess file:
    AddType application/xml opml
    After uploading that addition, my OPML file renders the same way that Ton’s file doessuccess!

Comments are closed.

Mentions