Search code examples
typo3typo3-7.6.xtx-news

Fallback og:image if no images are present in an ext:news story


TYPO3 v 7.16. cs_seo 2.3.3 news 6.3.0

I have disabled cs_seo on my news detail page and ext:news is generating the correct og & twitter card meta data as expected. However, if I have a story that doesn't feature an image, no default image is present. Is it possible to set a fallback/default image to be used for News stories?

(If I enable cs_seo on the news detail page, it overrides any metadata generated by ext:news)

Thanks again,

Tom


Solution

  • Bernd - thanks for getting back to me. The "dummy image" is set, however it is not configured to be included on Detail pages (as far as I can tell).

    I came across a support thread for cs_seo extension which allows you to set a fallback image.

    https://github.com/clickstorm/cs_seo/issues/92

    I used the following typoscript setup on my Detail page.

    tx_csseo {
    1 = tx_news_domain_model_news
    1.fallback {
        og_image = fal_media
    }
    }
    

    In the cs_seo extension I had to set the TSConfig PID to my Detail page, I also included the Page TSConfig "Extend News Records".

    I then noticed that on News Detail pages I had two sets of OG metadata. One being generated by ext:News and the other by cs_seo. I removed the following partial include from my Detail Template

    <f:render partial="Detail/Opengraph" arguments="{newsItem: newsItem, settings:settings}" />
    

    I now have one set of OG tags and a fallback image in place.