Learn about the top 2016 CMS trends. Read on.


Acqal is pleased to announce the version 1.0.0 release of aqnewsmeta. This extension updates the TYPO3 newsSubheader register with a truncated, HTML-free version of the news bodytext if no article teaser is available.

This is helpful for SEO purposes where each news entry should have a META description, but doesn’t.

The extension includes options to adjust the META description length, currently set at 150 characters, per SEO best practices.

References

Still stuck? Write us.

  • Okay, I figured how to get what I wanted with TypoScript and simplify things a little.

    I’m already using the awesome seo_basics extension and I decided to add onto their TypoScript setup. In my changes, ‘m also defaulting my page meta description to the page title, when there’s no page description.

    Next, there’s the start of my canonical link tag. However, the exclude property isn’t working for array type parameters like tx_ttnews[tt_news] for being removed from category pages. Frustrating…

    Also, when on news pages, meta description tries for the news article short text, but if none, it grabs and crops the bodytext.

    # if no page description or default, at least bring in page title
    plugin.tx_seobasics.40.ifEmpty.data = page:title
    
    # create canonical tag
    plugin.tx_seobasics.60 = TEXT
    plugin.tx_seobasics.60 < .30
    plugin.tx_seobasics.60 {
    	stdWrap >
    	typolink {
    		parameter.data = TSFE:id
    		addQueryString = 1
    		addQueryString {
    			method = GET
    			exclude = id,tx_ttnews[backPid]
    		}
    		returnLast = url
    	}
    	wrap = 
    }
    
    # keep article links out of canonical urls
    [globalVar = GP:tx_ttnews|cat > 0]
    	plugin.tx_seobasics.60.typolink.addQueryString.exclude = id,tx_ttnews[tt_news],tx_ttnews[backPid]
    [global]
    
    [globalVar = GP:tx_ttnews|tt_news > 0]
    	plugin.tx_seobasics.30.stdWrap >
    	plugin.tx_seobasics.30.data = register:newsKeywords
    
    	plugin.tx_seobasics.40.stdWrap >
    	plugin.tx_seobasics.40.data = register:newsSubheader
    	plugin.tx_seobasics.40.ifEmpty >
    	plugin.tx_seobasics.40.ifEmpty.cObject = RECORDS
    	plugin.tx_seobasics.40.ifEmpty.cObject {
    		dontCheckPid = 1
    		tables = tt_news
    		source.data = GPvar:tx_ttnews|tt_news
    		source.insertData = 1
    		conf.tt_news = TEXT
    		conf.tt_news {
    			field = short
    			ifEmpty.field = bodytext
    			required = 1
    			htmlSpecialChars = 0
    			crop = 150|...|1
    			stripHtml = 1
    			trim = 1
    		}
    	}
    [global]
    
  • As the code above does what I want it to do and doesn’t cause the tt_news extension to spend extra cycles or time to generate a page, I’ve turned off the extension aqnewsmeta. I’d suggest for you to do the same.

  • Dmitry,

    Thank you for the code suggestion. I had seen this before.

    1. Why do you generate the meta tag fully instead of letting TYPO3 do so via the following?

    page.meta.keywords = {$site.meta.keywords}
    page.meta.keywords.if.isTrue = {$site.sitewide.seo}
    page.meta.keywords.override.field = keywords
    
    page.meta.description = {$site.meta.description}
    page.meta.description.if.isTrue = {$site.sitewide.seo}
    page.meta.description.override.field = description

    The above code lets a global SEO setting be made and in turn be overridden by SEO settings in page properties.

    2. Your code doesn’t account for there being no tt_news.short data. The extension does by checking for the tt_news.short field and if there’s nothing, then cropping tt_news.bodytext down to size. See http://typo3.org/extensions/repository/view/aqnewsmeta.

    In reality, your code and the aqnewsmeta extension can work side-by-side still because aqnewsmeta is updating register:newsSubheader with data one way or another.

    3. On our article pages, we use the following TypoScript for news meta tags.

    page.meta.keywords >
    page.meta.keywords.data = register:newsKeywords
    
    page.meta.description >
    page.meta.description.data = register:newsSubheader

    Your thoughts?

    On a side note, it’s not recommended to use sitewide SEO settings as search engines really ding websites with them. However, sometimes clients ask for stuff and won’t take best practices to heart. So it’s there…

  • Dmitry, thank you again for the comments.

    However, I really think you’re missing the point of the extension. It’s not to generate the META tag, but to populate the register:newsSubheader with truncated, HTML free news bodytext when the news teaser is empty.

    This is something that’s not possible by TypoScript. Sure TypoScript has REGISTER access, but it doesn’t readily have the tt_news record information handy.

    I know it’s possible to pull the tt_news record via RECORDS, but we’re getting to the point of creating something most folks don’t get.

  • Here’s the TypoScript to pull the news short or bodytext. I’m still trying to figure out how to push it to page.meta.description, such that the meta description tag is created correctly without resorting to generating my own page.headerData entry.

    lib.news.meta.description = RECORDS
    lib.news.meta.description {
            dontCheckPid = 1
            tables = tt_news
            source.data = GPvar:tx_ttnews|tt_news
            source.insertData = 1
            conf.tt_news = TEXT
            conf.tt_news {
            	field = short
            	ifEmpty.field = bodytext
            	required = 1
            	htmlSpecialChars = 0
            	crop = 150|...|1
            	stripHtml = 1
            	trim = 1
            }
    }

    Ideas to improve this are welcome.

  • thanks sharing for this post.meta descriptions are no longer a ranking factor but optimizing it properly can help to get higher click through rates.