Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted July 6, 20213 yr 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 Any tips?
July 7, 20213 yr Maybe this will help you : Working fine with 4.6.x See my source code: view-source:https://ggames.com.br/files/file/3405-trainer-police-stories-mrantifun/
July 7, 20213 yr Author 1 hour ago, 403 - Forbiddeen said: Maybe this will help you : Working fine with 4.6.x 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
July 7, 20213 yr 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 July 7, 20213 yr by opentype
July 7, 20213 yr Author 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? 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 July 7, 20213 yr by Hisashi
July 7, 20213 yr See my code example. You need to use the variables directly, not {like this}. This code is not “template output”.
July 7, 20213 yr Author 9 minutes ago, opentype said: See my code example. You need to use the variables directly, not {like this}. This code is not “template output”. I managed to solve it, just remove the code "|raw" Edited July 7, 20213 yr by Hisashi