[RFC|Merged] Optimized Page Titles patch

These requests for comments/change have lead to an implemented feature that has been successfully merged into the 3.1/Ascraeus branch. Everything listed in this forum will be available in phpBB 3.1.
User avatar
VSE
Extension Customisations
Extension Customisations
Posts: 670
Joined: Mon Mar 08, 2010 9:18 am

[RFC|Merged] Optimized Page Titles patch

Post by VSE » Fri Apr 09, 2010 6:23 pm

This is a patch that will tweak phpBB's page titles in the following way (in response to this topic viewtopic.php?f=81&t=32730)
It aims to correct the page titles in phpBB to be more search engine friendly and bookmark friendly.
• When viewing forums, forum names come first, followed by the site name: Current Forum - My Site Name
• When viewing topics, topic titles come first, followed by the site name: Current Topic - My Site Name
• The 'View Forum' and 'View Topic' text is omitted from the title.
• This will also add Page Numbering to paginated forums and topics, (this idea/code inspired from a MOD by Greenweaver and Evil<3): Current Topic - Page 3 - My Site Name.
• The use of bullets are replaced by hyphens, so there are always only hyphens between title subjects
• All other pages like UCP, MCP, etc will display the page title the way phpBB has in the past, except using hyphens instead of bullets

Open: viewforum.php

FIND:

Code: Select all

// Dump out the page header and load viewforum template
page_header($user->lang['VIEW_FORUM'] . ' - ' . $forum_data['forum_name'], true, $forum_id); 
REPLACE WITH:

Code: Select all

// Dump out the page header and load viewforum template
page_header($forum_data['forum_name'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], floor($start / $config['topics_per_page']) + 1) : ''), true, $forum_id); 
Open: viewtopic.php

FIND:

Code: Select all

// Output the page
page_header($user->lang['VIEW_TOPIC'] . ' - ' . $topic_data['topic_title'], true, $forum_id); 
REPLACE WITH:

Code: Select all

// Output the page
page_header($topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], floor($start / $config['posts_per_page']) + 1) : ''), true, $forum_id); 
Open: language/en/common.php

FIND:

Code: Select all

'PAGE_OF'                => 'Page <strong>%1$d</strong> of <strong>%2$d</strong>', 
ADD AFTER:

Code: Select all

'PAGE_TITLE_NUMBER'        => 'Page %s', 
Open: styles/prosilver/template/overall_header.html (and styles/subsilver2/template/overall_header.html)

FIND:

Code: Select all

<title>{SITENAME} &bull; <!-- IF S_IN_MCP -->{L_MCP} &bull; <!-- ELSEIF S_IN_UCP -->{L_UCP} &bull; <!-- ENDIF -->{PAGE_TITLE}</title>
REPLACE WITH:

Code: Select all

<title><!-- IF not S_VIEWTOPIC and not S_VIEWFORUM -->{SITENAME} - <!-- ENDIF --><!-- IF S_IN_MCP -->{L_MCP} - <!-- ELSEIF S_IN_UCP -->{L_UCP} - <!-- ENDIF -->{PAGE_TITLE}<!-- IF S_VIEWTOPIC or S_VIEWFORUM --> - {SITENAME}<!-- ENDIF --></title>
Has an irascible disposition.

User avatar
imkingdavid
Registered User
Posts: 1050
Joined: Thu Jul 30, 2009 12:06 pm

Re: [RFC] Optimized Page Titles patch

Post by imkingdavid » Fri Apr 09, 2010 7:51 pm

Looks great to me. :mrgreen:
I do custom MODs. PM for a quote!
View My: MODs | Portfolio
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.

User avatar
VSE
Extension Customisations
Extension Customisations
Posts: 670
Joined: Mon Mar 08, 2010 9:18 am

Re: [RFC] Optimized Page Titles patch

Post by VSE » Fri Apr 09, 2010 8:03 pm

I tried pushing this to phpBB3's git repo... but I can't get it to work...

I was able to clone phpbb3 from git://github.com/phpbb/phpbb3.git

But when I try to push after I made changes and commit them, I get the error:
fatal: remote error:
You can't push to git://github.com/phpbb/phpbb3.git
Use git@github.com:phpbb/phpbb3.git

Hopefully somebody here who is more Git-savvy can submit these changes for me :oops:
Has an irascible disposition.

User avatar
igorw
Registered User
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

Re: [RFC] Optimized Page Titles patch

Post by igorw » Fri Apr 09, 2010 8:09 pm

You cannot push to phpBB's git repository. You must create a hosted fork on github (or any other git hosting service) and push to that. As per my PM, I'd be glad to talk you through it.

code reader
Registered User
Posts: 653
Joined: Wed Sep 21, 2005 3:01 pm

Re: [RFC] Optimized Page Titles patch

Post by code reader » Fri Apr 09, 2010 9:25 pm

or you can just "git clone" to your local machine, and use "git format-patch" > somefile and post the patch.

a bit less beaurocracy than forking for a single patch.
if you intend to do mode development, it does make sense to fork - i just wanted to note that it's not the *only* option.

naturally, the "FIND/REPLACE WITH/AFTER ADD" syntax should be avoided.


peace.

User avatar
ameeck
Registered User
Posts: 86
Joined: Sun Nov 13, 2005 6:43 pm
Location: Prague, Czech Republic
Contact:

Re: [RFC] Optimized Page Titles patch

Post by ameeck » Fri Apr 09, 2010 9:39 pm

Is there a reason to replace bullets with hyphens?
Please think before you post.

User avatar
VSE
Extension Customisations
Extension Customisations
Posts: 670
Joined: Mon Mar 08, 2010 9:18 am

Re: [RFC] Optimized Page Titles patch

Post by VSE » Fri Apr 09, 2010 9:54 pm

ameeck wrote:Is there a reason to replace bullets with hyphens?
Just for consistency... Currently phpBB titles use a mix of bullets and hyphens... It just comes down to preference, and I chose to go with hyphens.. 8-)
Has an irascible disposition.

User avatar
VSE
Extension Customisations
Extension Customisations
Posts: 670
Joined: Mon Mar 08, 2010 9:18 am

Re: [RFC] Optimized Page Titles patch

Post by VSE » Fri Apr 09, 2010 9:56 pm

Well, here I will attach a patch of these changes I committed in GIT, taking the lesser beaurocracy approach for now :lol:
Attachments
0001-Page-Title-s-corrected.-Removed-View-Forum-View-Topi.patch
(4.62 KiB) Downloaded 1576 times
Has an irascible disposition.

User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: [RFC] Optimized Page Titles patch

Post by nickvergessen » Fri Apr 09, 2010 10:48 pm

VSE+ wrote:
ameeck wrote:Is there a reason to replace bullets with hyphens?
Just for consistency... Currently phpBB titles use a mix of bullets and hyphens... It just comes down to preference, and I chose to go with hyphens.. 8-)
We use a bull to part board-title from the rest, everything else is split by hyphens
Member of the Development-TeamNo Support via PM

User avatar
naderman
Product Manager
Product Manager
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Karlsruhe, Germany
Contact:

Re: [RFC] Optimized Page Titles patch

Post by naderman » Sun Apr 11, 2010 1:02 pm

Since we already have a discussion topic on this, I don't see a reason not to just put this patch on the tracker. Can you open a new Improvement ticket for 3.1 please?

Post Reply