Google news doesn't include News item image - best way to add a file extension to the url

classic Classic list List threaded Threaded
5 messages Options
AnthonyG AnthonyG
Reply | Threaded
Open this post in threaded view
|

Google news doesn't include News item image - best way to add a file extension to the url

Hi,

We've configured our site so that our news section appears in Google news by regularly submitting a news sitemap to Google.  Unfortunately since migrating to Plone our news items that appear in Google no longer have a picture associated with them.  Having looked at the Google news guidelines for images it seems this is almost certainly because the image url for the image added to the Plone News item doesn't include a file extension.

e.g. the url for the image for a recent article looks like

http://www.soschildrensvillages.org.uk/charity-news/charity-editorials/should-you-claim-a-a3113m-euro-lottery-prize/image

Whereas Google want it to look like:

http://www.soschildrensvillages.org.uk/charity-news/charity-editorials/should-you-claim-a-a3113m-euro-lottery-prize/image.jpeg

We'd like to fix this and my plan is roughly:
* add a method to that returns the image url suffixed with the appropriate file extension for the image.  I'm thinking I should do this with an adaptor
* use this method in our news item template (we already override this)
* get newsitem to ignore the suffix when serving the image

This last part I'm a bit stuck on.  Can I do this with an adaptor as well or do I need to override the ATNewsItem.__bobo_traverse__ somehow (how would I do that?).

We're on Plone 3.3.3 at the moment but are planning to upgrade to 3.3.5 this release.
Mikko Ohtamaa Mikko Ohtamaa
Reply | Threaded
Open this post in threaded view
|

Re: Google news doesn't include News item image - best way to add a file extension to the url

AnthonyG wrote
This last part I'm a bit stuck on.  Can I do this with an adaptor as well or do I need to override the ATNewsItem.__bobo_traverse__ somehow (how would I do that?).
A possible solution:

1) Create a new BrowserView called "ImageDownload" and register it with name @@myimagedownloader.jpeg against ATNewsItem

2) Modify news / sitemap code so that this view is used for images http://yoursite/news/@@imagedownload.jpeg

3) The ImageDownload view copies the image binary streaming code from ATImage and also sets some HTTP headers if required by Google



 
AnthonyG AnthonyG
Reply | Threaded
Open this post in threaded view
|

Re: Google news doesn't include News item image - best way to add a file extension to the url

Thanks Mikko,

This looks like it'll work.  Can you register BrowserViews with wildcards?  e.g.  myimagedownloader.*

On 16/10/2010 23:16, Mikko Ohtamaa wrote:

>
> A possible solution:
>
> 1) Create a new BrowserView called "ImageDownload" and register it with name
> @@myimagedownloader.jpeg against ATNewsItem
>
> 2) Modify news / sitemap code so that this view is used for images
> http://yoursite/news/@@imagedownload.jpeg
>
> 3) The ImageDownload view copies the image binary streaming code from
> ATImage and also sets some HTTP headers if required by Google
>


_______________________________________

Anthony Gerrard
Email: [hidden email]
http://www.sponsorachild.org.uk


------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Mikko Ohtamaa Mikko Ohtamaa
Reply | Threaded
Open this post in threaded view
|

Re: Google news doesn't include News item image - best way to add a file extension to the url

AnthonyG wrote
Thanks Mikko,

This looks like it'll work.  Can you register BrowserViews with wildcards?  e.g.  myimagedownloader.*
Yes and no.

You probably want a custom traverser which does

obj/myimagedownloader/somemagicalpathpartid by your code.

You can do this by adding method __geitem__(self, partid) to your view.

-Mikko
AnthonyG AnthonyG
Reply | Threaded
Open this post in threaded view
|

Re: Google news doesn't include News item image - best way to add a file extension to the url

Mikko,

Your suggestion worked a treat.  Thank you!

If anyone's interested I've posted the code for the view here

http://www.scarba05.co.uk/blog/2010/11/including-a-file-extension-for-the-plone-news-item-image/

Anthony