Options

Tweaking captions of the RSS feed

TheBubbleBoyTheBubbleBoy Registered Users Posts: 11 Big grins
My first problem is that the caption field in the RSS feed is being cut of. It ends prematuraly with ' ...'

Is there anyway to increase the maximum number of caption characters (I tried adding &CaptionLength=xxx to the feed url but that didn't work)


Also:

Is there anyway to turn off the automatic stripping of HTML tags? Right now, I have to write really unreadable captions such as <b>Title:</b> Bubblying<br> <b>When:</b> Yesterday... to get the proper HTML tags in the RSS feed. But typing <b>Title:</b> Bubblying<br/><b>When:</b> Yesterday would be way nicer and efficient....

Comments

  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited March 26, 2009
    Can you give us an example URL?

    I've never run into my captions being truncated, but I don't write very long captions.
  • Options
    TheBubbleBoyTheBubbleBoy Registered Users Posts: 11 Big grins
    edited March 27, 2009
    darryl wrote:
    Can you give us an example URL?

    I've never run into my captions being truncated, but I don't write very long captions.

    For instance: http://bubbleboy-studios.smugmug.com/hack/feed.mg?Type=gallery&Data=7469343_SYnHc&format=rss200

    These are not even very long captions. Most of the length is caused by the complex encoding of the HTML.

    I guess I can also change the Lightbox javascript code so it inserts some HTML of its own to elevate the problem a bit, but I'm still hoping one of SmugMug's support heroes drops by and reveals one of his 'super-secret' RSS feed parameters. Where is SuperMan when you need him :cry......:D
  • Options
    TheBubbleBoyTheBubbleBoy Registered Users Posts: 11 Big grins
    edited April 3, 2009
    Okay, I've adapted the Wordpress Lightbox plugin (the one the WP-SmugMug plugin links to) so it automatically scans the RSS captions and adds HTML formatting elements.

    Captions should be in a format like this:

    Enter here the title, you can use as many spaces as you like.
    Description: enter here your description
    Artist: enter here the artist name

    The newlines are not required and kind of hard to do if you're are using the mass-caption management tools. You can use as many 'fdgdfg: gdgfgfd' fields as you want. That is until the RSS feed considers it too long :D

    The code below replaces the existing code in 'jquery.lightbox.js' below the comment '// Extract description from title'
                            var caption_text = image.title;
                            var begin_seperator = 0;
                            var last_end_seperator = 0;
                            var end_seperator = caption_text.indexOf(': '); 
    
                            if (end_seperator > 0)
                            {    // Description exists
                                begin_seperator = caption_text.lastIndexOf(' ', end_seperator);
                                
                                image.title = caption_text.substring(0, begin_seperator);
    
                                image.description = '<b>'+caption_text.substring(begin_seperator+1, end_seperator+2)+'</b>';
                                
                                while(true)
                                {
                                    last_end_seperator = end_seperator;
                                    end_seperator = caption_text.indexOf(': ', end_seperator + 2);
                                    
                                    if(end_seperator <= 0)
                                        break;
                                        
                                    begin_seperator = caption_text.lastIndexOf(' ', end_seperator);
                                    
                                    image.description += caption_text.substring(last_end_seperator+2, begin_seperator) +'<br><b>'+caption_text.substring(begin_seperator+1, end_seperator+2)+'</b>';
                                    
                                        
                                }
                                
                                image.description += caption_text.substring(last_end_seperator+2);
                                
                            }
                            
                            image.title = image.title + '<br>';
    

    Hope this helps somebody...
Sign In or Register to comment.