Forum
Generating unique page titles/meta for detail pages
Although I have my own solution for this, I always seem to struggle a bit with the best way of generating unique page meta (titles and descriptions) for the detail pages in the List and Detail solutions. I end up with something like this:
<title><?php if(empty($_GET)) {
perch_pages_title();
}
else
{
perch_content_custom .... [with unique template]
}
?></title>
and something similar for meta descriptions. I'm sure this isn't very efficient.
I've done some searches in the forum and there are a few solutions but I'm wondering the best way of doing this. I appreciate that every site is different but could this be added to the List and Detail solutions?
Are you using layouts, or just flat pages?
Layouts in this case. My older Perch sites have flat pages though.
Is the inconvenient part the logic, or the template, or something else?
I understand it (logic and template) but I always feel that this way of doing it is a bit 'clunky'. Perhaps I'm being over critical.
I'll have a dig round the forum again and see if anything else looks better.
I'm just trying to figure out how to make it easier.
Many thanks.
I found this thread https://forum.grabaperch.com/forum/12-10-2014-title-in-the-header-layout-list-detail-page which seems like a good approach so will test it on a few pages here.