This project is read-only.

Enclsoure tag with images

Topics: Business Logic Layer
Feb 20, 2013 at 5:35 PM
Is there a way for the first image in a post to be placed in an enclosure tag in the rss feed so that we can pull it out in an app from the rss feed?
Feb 20, 2013 at 8:28 PM
Edited Feb 20, 2013 at 9:26 PM
There is enclosure support in BE if this is what you looking for.

You turn it on from admin/settings/feed using "enable enclosure" setting. After that, first link with valid media type will be placed in enclosure tag in RSS feed, so you can submit your feed as podcast to iTunes for example.

It won't work for images though, as it is not valid media type, or at least was not valid when we added enclosures.

But you can try to add it to supported types if you want, may be it will work for you.
Unfortunately you'll have to modify core library for it, but if you really really need it:
  1. download source from "source code" tab on this page corresponding to your BE version
  2. open in VS 2012 file "BlogEngine.Core/SyndicationGenerator.cs"
  3. add your type to this collection:
    var dic = new Dictionary<string, string>
    { ".mp3", "audio/mpeg" },
    { ".m4a3", "audio/x-m4a" },
    { ".mp4", "video/mp4" },
    { ".m4v", "video/x-m4v" },
    { ".mov", "video/quicktime" },
    { ".pdf", "application/pdf" }
  4. build project and move BlogEngine.Core.dll from local to your server.