Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
LiquidFractal Posted December 23, 2017 Posted December 23, 2017 I have an "About Me" page on my website which is in a DB called "About LiquidFractal." I've noticed that when this page is viewed, the generated page title is "About X - About LiquidFractal - LiquidFractal," following a Record>DB>website format. Could someone please tell me how I can customise the display template so that just the record title displays for the HTML title, i.e. "About X"? This isn't only cosmetic, as I know that Google will sometimes penalise code which needlessly repeats keywords. Incidentally, this also happens in the Who's Online view, where someone will be listed as "Currently viewing About X - About LiquidFractal - LiquidFractal," so if I could change this template as well that would be a bonus! Thanks in advance, and happy holidays to everyone!
opentype Posted December 23, 2017 Posted December 23, 2017 It can only be changed in the template code for database records. e.g. {{\IPS\Output::i()->metaTagsTitle = $record->_title;}}
LiquidFractal Posted December 23, 2017 Author Posted December 23, 2017 38 minutes ago, opentype said: It can only be changed in the template code for database records. e.g. {{\IPS\Output::i()->metaTagsTitle = $record->_title;}} Thanks @opentype. Would you happen to know the exact template? I've been searching (thought it might be in Database Templates>Display>Record, but can't find anything related to output there).
opentype Posted December 23, 2017 Posted December 23, 2017 18 minutes ago, liquidfractal said: Database Templates>Display>Record Yes, that’s where I put it. It doesn’t really matter. It just needs to be a template that is used for creating the page. There is no such code in there yet. You can just put it there.
LiquidFractal Posted December 23, 2017 Author Posted December 23, 2017 2 hours ago, opentype said: Yes, that’s where I put it. It doesn’t really matter. It just needs to be a template that is used for creating the page. There is no such code in there yet. You can just put it there. Thanks again. Would this go in a specific location in the template, i.e. beginning or end of the other code? Sorry for the questions but I'm not a dev or template guy.
Meddysong Posted December 23, 2017 Posted December 23, 2017 I don't think this is generated from a database template. I think it comes from the page that you've tied your database to, which is a normal feature; the page needs a title but it unfortunately contains repeated text in this case. Maybe try editing the page, click Title & Meta Tags and give it a new title. Perhaps that will overwrite it. (It reads "This value will be used in the document's HTML title tag. If omitted, the page name will be used instead." which sounds like it fits the bill, though I can't see it taking any effect at all where I've just tried it on my site.)
opentype Posted December 23, 2017 Posted December 23, 2017 2 hours ago, liquidfractal said: Would this go in a specific location in the template, i.e. beginning or end of the other code? As I said: it doesn’t matter. You just hand over a variable to the system telling it to override the default title. As long as you put it in a template that is being used, it will work. What Meddysong says only refers to single pages, not database records on a page.
LiquidFractal Posted December 23, 2017 Author Posted December 23, 2017 10 hours ago, opentype said: As I said: it doesn’t matter. You just hand over a variable to the system telling it to override the default title. As long as you put it in a template that is being used, it will work. What Meddysong says only refers to single pages, not database records on a page. Thanks - this is very useful. What would I add to that line if I ended up wanting to include the site name at the end of the HTML title (as per default IPS config), but leave out the DB name in the middle? EDIT: funny...I write myself little how-to articles with these kinds of tips in case I need to customise my site in the future. When I tried to add that \IPS\Output line as a code snippet in an article it shows up in the edit window but won't display when viewing the article...maybe because the software is trying to parse it?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.