Jump to content

Cutoff og:description to avoid html bloating


Recommended Posts

when using pages and adding some articles, the og:description holds the whole article and bloats the html page.

I would suggest to use only max 200 characters for the description.

E.g. in the includeMeta Template I use this code:

{{foreach \IPS\Output::i()->metaTags as $name => $content}}
	{{if $name != 'title'}}
		{{if is_array( $content ) }}
			{{foreach $content as $_value }}
				<meta {{if mb_substr( $name, 0, 3 ) === 'og:'}}property{{else}}name{{endif}}="{$name}" content="{{substr($_value,0,strpos($_value, ' ', 200));}}">
			<meta {{if mb_substr( $name, 0, 3 ) === 'og:'}}property{{else}}name{{endif}}="{$name}" content="{{$trc=substr($content,0,200);}}$trc">

But I'm not really firm with coding....

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...