Jump to content

Help customize meta tags


Go to solution Solved by opentype,

Recommended Posts

Hello,

I want to make a custom meta description in Pages > Record

I tried using code and it didn't work, how do I provide the following data in tag...

  • Article title
  • Field > template key

Tried something like this but the codes don't work

Screenshot_37.thumb.png.d5567627b2c985765d8b6e2f3c6bcb24.png

 

Any tips?

Link to comment
Share on other sites

1 hour ago, 403 - Forbiddeen said:

Maybe this will help you : 

Working fine with 4.6.x

image.png.ab32f8edde2ac9ce759369765cc7fe2b.png

See my source code: view-source:https://ggames.com.br/files/file/3405-trainer-police-stories-mrantifun/

 

 

 

That's not quite what I want to do

Link to comment
Share on other sites

  • Solution
20 hours ago, Hisashi said:

Any tips?

The meta tags can be overridden from any Pages template used to render the current page. You can add variables there as well. 

{{\IPS\Output::i()->metaTagsTitle = "Whatever ".$something ;}}
{{\IPS\Output::i()->metaTags['og:description'] = "Something else" ;}}

You can put that into the record template for example. 

Edited by opentype
Link to comment
Share on other sites

27 minutes ago, opentype said:
{{\IPS\Output::i()->metaTags['og:description'] = "Something else" ;}}

 

That's exactly what I was looking for!

I just had a little problem, it doesn't allow me to use template key field, an error appears, do you know how to solve it?

Screenshot_39.png.7fc1255a5189519f8037004000421c82.png
 

How do I want it to look for example:

{{\IPS\Output::i()->metaTags['og:description'] = "Read more about {$record->_title}. By {$record->customFieldDisplayByKey('author', 'raw')|raw}" ;}}

It is not accepting customFieldDisplayByKey

Edited by Hisashi
Link to comment
Share on other sites

  • Recently Browsing   0 members

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