Closed (fixed)
Project:
Page Title
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
19 Sep 2007 at 17:40 UTC
Updated:
12 Jul 2011 at 11:11 UTC
Jump to comment: Most recent file
it would be nice to be able to specify a different page title for views as well
1) line 194 of the module would have to say
if (drupal_is_front_page() || !$page_title) {
because the view might not have a drupal_title
2) i suppose a form alter for the view edititng page would be needed as well
3) also an extra column for the page_title table to handle vid
4) not sure, but there has got to be a way to hook into the view load operation and set the page title
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | page_title_meets_views_again2.patch | 10.08 KB | nicholasthompson |
| #8 | page_title_meets_views_again.patch | 7.68 KB | nicholasthompson |
| #7 | page_title_meets_views.patch | 9.5 KB | nicholasthompson |
Comments
Comment #1
nicholasthompsonInteresting idea! Should be fairly easy to do - I'll look into how Nodewords handles meta data for almost all page types...
Comment #2
SimonV commentedHas anyone had any luck with this?
Comment #3
nicholasthompsonI haven't had time to look at this yet. Its something I'd like to integrate into PageTitle2...
Comment #4
lefnire commentedbump, quite a silently in-demand feature, actually! I thought it sounded like a must have, so i talked to other SEO-savvy drupallers to see how they've been getting by without it... most have been doing work-arounds, like getting the PHP code for a view, pasting it into a new Page from which they CAN control the page title.
Comment #5
xpi commentedi need that too.
i use 'title' with pathauto in mind,
'page title' is exactly that what i want to display.
Comment #6
SimonV commentedMy work around is much simpler. Check out the Insert Views module (http://drupal.org/project/insert_view). Although it is very easy to just make a page and display a View within it, it's a few extra steps and it would be great to see Page Title exposed to Views.
Comment #7
nicholasthompsonI attach a patch which has been lightly tested...
Feedback needed and appreciated.
Basically this patch adds a field to the page fieldset of a view where you can set the Head Title of the view. The patch also reworks the way the the module stores the page titles - so upon patching you will need to run a database upgrade. DO NOT TEST THIS ON LIVE! The database update changes the ID field from 'nid' to 'pid', adds a new column called 'type' and recreates the primary key.
What probably needs doing is defining either a default view token template and/or a token template for all views. Maybe (just as a thought) the Head Title should also allow tokens too? This might allow you to say [term-name] in the Head Title which would make things like the taxonomy/term override better... But the issue is making the token_replace aware of the scope (node, taxonomy, user, etc).
Anywho - thoughts?
Comment #8
nicholasthompsonHere is a second patch with fixes/improvements. It is also re-rolled against ALPHA5....
Please review!
Comment #9
nicholasthompsonI have noticed some errors in the patch and am working on this right now... will post another patch later this morning.
Comment #10
nicholasthompsonOk, more fixes are here...
Checkout DRUPAL-5--2-0-ALPHA5 version of PageTitle, patch it with this patch and then run update.php as this required changes to the database table.
DO NOT RUN THIS ON A LIVE SERVER!
Each view will now have a field called "Head Title" where you can provide the title for the View. You can use tokens in the head title... So, for example you could define the View Head Title as "Term: [cat]" which will cause every "taxonomy/term" page to use the term name in the title...
Apart from testing this and providing feedback, one thing that we need to figure out is how to handle arguments as tokens... The way I am doing it right now is I am checking all the arguments that the view can take against all the arguments provided and doing one token_replace on each one - although currently its only programmed to handle the "taxid" argument.
Thoughts?
Comment #11
evo commentedHi Nicholas, thanks for the patch. I tried it on alpha5 and ran update.php but the views page title do not work it displays the default patterns. Perhaps I copied the patch incorrectly, if possible can you please upload the full install and module files including patches?
Thanks
Comment #12
nicholasthompsonI'll give it a go at some point.
Nick
Comment #13
summit commentedHi, any progress in this field please?
greetings,
Martijn
Comment #14
hawkdrupal commentedViews are essential to a well-structured Drupal site. BUT...
The biggest problem is that while a view generates a web page, it doesn't provide the same control over it that is available in any normal node/page. That's a huge shortcoming, easy to see from the many postings here and elsewhere about hacking views.
The Page Title module is also essential. So, modifying it to handle views is an urgent need.
Comment #15
nicholasthompsonIt is an "in progress" part of the DRUPAL-5--2 branch which is currently an "in progress" snapshot... I'm working on it but dont have a massive amount of free time at my disposal.
Comment #16
d.sibaud commentedsubscribe, I need too this very useful patch ;-)
Comment #17
prestonso commentedWhat is the status of this feature request in d6?
Comment #18
nicholasthompsonIt's (for me at least) "in progress when I have a spare day"
If anyone here is headed to DrupalCon Szeged - I'd be interested in having a chat with you about this!
Comment #19
PeterZ commented+1 for this request. This would be really great!
Comment #20
carj commentedI created a table views. it shows an error message for anonymous user while it's working fine for authenticated users.
Here is the error message: » warning: Invalid argument supplied for foreach() in :\hshome\myname\modules\views\theme\views-view-table.tpl.php on line 22.
Even if I configured the block to be visible for both.
Thanks
Comment #21
nicholasthompsonMoving this down to a normal priority as the "patterns for paths" issue (#289389: Advanced token replacement based on path for page titles) would be a quicker and easier solution in the immediate future until I get a chance to play with Views 2 more...
Comment #22
Pushkar Gaikwad commentedHi, WHat is the status of this ? I am running drupal 5.x and certainly needs this module to get rid of that sitename in views titles. any suggestions ?
Comment #23
nicholasthompsonUsing Page Title 2, you can configure the "default" Page Title pattern to be just the [title] or [page-title]. This will remove the Site Name from all pages, including views.
The "Support For Views" issue is actually so people can define a View Title and a View Page Title separately.
Comment #24
d.sibaud commentedSo, I didn't underststood, in tha release candidate 2.0 there will be this feature?
Hoping so,
Comment #25
nicholasthompsonThe problem with implementing Views page title's is figuring out the scope of the View (is it a view of nodes by user, taxonomy, date, location... etc).
Page Title 2.0 will contain a feature to configure page titles for a URL based on certain token "scopes"... It's a "work in progress".
Comment #26
d.sibaud commentedthks, I'll wait for the 2.0 release.
Comment #27
jeffabailey commentedsubscribing
Comment #28
Flying Drupalist commentedHi, is this in the cards for 6.x? Thanks.
Comment #29
nicholasthompsonIt is - just needs time...
Comment #30
Flying Drupalist commentedThank you, but currently views titles is completely f'ed up. Is there a way to restore titles to doing the default thing but for views only?
Comment #31
wflorian commentedIs there a date when we could a expect a version of "Page-Title" with Views integration? I am sorry for not beeing a helpful hand but my PHP knowledge is very limited.
Comment #32
nicholasthompsonUnfortunately there is no date.... Sorry.
Comment #33
Augusto Ellacuriaga commentedSubscribing! It'll be nice to have that functionality since hacking views can be a pain at times.
FYI, the easiest way I found to deal with different page titles and view titles is by inserting the view into a page node. Just follow this instructions http://drupal.org/node/336097 and optimize the page as if you were optimizing it with the page title and meta tags modules :)
The following snippet unfortunately did not work since it changes both titles:
If you have any other php hack, please share it. Thanks
Comment #34
patchak commentedIs there any feature to at least a page number on views pagers now for d6??
Thanks
Comment #35
summit commentedHi,
It would be great if the views-title would be supported by page_title. This way theming the termtitle, nodetitle and viewstitle would be better equiped through pagetitle!
Greetings, Martijn
Comment #36
nicholasthompson@patchak: Page Numbering is coming... Waiting for #224262: Add Page Number token...
@Summit: Not sure what you mean. View's title gets set through drupal_set_title() which in turn is picked up by Page Title if the page is not a node, term or user (or front)....
Comment #37
Triskelion commentedViews picks up the default title defined by page title. The page number patch for D6 tokens is two lines of code and works fine with D5. I now append the page number to the default pattern which means all my titles will have a 1 at the end, unless a pager is active (eg in views).
Views integration would mean I could restrict the token to views with an active pager, and I might be able to include tokens for filter terms on a case by case basis.
Comment #38
nicholasthompsonI see! So you'd like to specify different View token patterns...
I'll take a look at some point.
Comment #39
dicreat commentedAny worked solution for use Page title in Views?
Thanks.
Comment #40
wflorian commentedAs far as I know: No! Also still looking for working solution!!
Comment #41
SimonV commentedSolved! Page Title by Path.
http://www.seodrupal.org/drupal-seo-modules/page-title-path
Comment #42
summit commentedHi, will you put your module also on drupal.org? Thanks for building this!
Greetings, Martijn
Comment #43
wflorian commentedAWESOME!! Thank you so much! I will give it a try this week! Coming back for feedback!
GREAT WORK!
Comment #44
nchase commentedinteresting. subscribing
Comment #45
OnlineWD™ commentedSubscribing need badly. Not sure if #41 works with latest version of node words as latest version makes meta by path obsolete and besides Page Title by Path is for Drupal 5, need a 6 solution.
Comment #46
nicholasthompsonA potential breakthrough for Views integration...
I added this to a test site in
page_title_get_title. This allows Page Title to correctly pickup the title generated by Views when you're on a page with an argument. Now all we need is to add a field to the argument panel + a function to the object to get the data processed and returned! Hmm...Comment #47
eaochoac commentedSubscribing too, I'm doing workarounds with these titles, Descriptions are ok with nodewords by path, but the tag for views is needed for version 6.
Comment #48
andyceo commentedsubscribing.
Comment #49
finex commentedsubscribing
Comment #50
aac commentedSubscribing!!
Comment #51
nicholasthompsonPlease don't change issue titles...
Comment #52
Evariste-1 commentedSubscribing
Comment #53
srobert72 commentedSubscribe
Comment #54
marco88 commentedNeed that for my partners view in http://www.mega-quick-sale.co.uk/partners
Subscribing.
Marc.
Comment #55
Andrew Gorokhovets commentedFirst of all it is Viwes Issue. (tokens in title and header) http://drupal.org/node/673700
Viwes module should be return correct .
Page Title module certainly should be able add something in Views Title.
Something is already in function "global title".
Comment #56
Andrew Gorokhovets commentedInteresting link http://drupal.org/node/365418 (Setting the View-Title programmatically in Views2)
Comment #57
alex dicianu commentedSubscribing.
Need it badly :)
Comment #58
nicholasthompsonI've just committed a tweak to DRUPAL-6--2 which allows any Views Page to have a static title. NOTE: This still does not support Arguments.
Comment #59
summit commentedHi, thanks for adding!
Will it be possible to add tokens to the static title?
greetings, Martijn
Comment #60
nicholasthompsonYeah I was playing with it last night and undid some of that work and have decided that all views Title's shouldn't actually be TITLE's... but Patterns instead. It'd have the same effect as a title but would allow tokens.
Comment #61
summit commentedGreat! Looking forward to it!. Is it on taxonomy and node view?
Greetings, Martijn
Comment #62
nicholasthompsonI've just committed some more work to the dev branch - now page display handlers can set a page title and each argument can set a page title which can use both global tokens or %1 placeholders.
However arguments are still not "context" aware, so node or term arguments are irrelevant.
Comment #63
summit commentedHi Nicholas,
May be context awareness could me made through ctools? This is a fine way of showing content of views/panels etc.. and has context awareness.
greetings, Martijn
Comment #64
nicholasthompsonSounds interesting - how would I go about that? Any examples I could read through?
Comment #65
summit commentedHi Nicholas,
Google is your friend, may be looking into: http://drupal.org/node/537776 and http://drupal.org/node/484340#comment-2642646 for tokensupport, read whole thread to get the idea.
Would be great to have page title also work in ctools through context and this way support arguments.
greetings, Martijn
Comment #66
nicholasthompsonOoo looks good - that'll be some bed time reading :-) Thanks for the pointers!
Comment #67
Brian294 commentedI wrote a helper module that combines the path/token capabilities of nodewords with the page_title module. You might want to check it out to see if it helps you solve this problem:
http://drupal.org/project/nodewords_pagetitle
Comment #68
aaron.r.carlton commentedsubscribing
Comment #69
nicholasthompsonI've been playing around with this and, as you can use the %1-type placeholders directly from the argument, I'm wondering how "relevant" contextual tokens would be to the argument. If you want the term name, then the placeholder will provide that as part of the argument (wont it?).
I've committed some fixes for the solution today and I think, for now, it's at an acceptable stage. I think I'd prefer to consider "contextual tokens" as part of a different thread as people may find that its not necessary.
Marking as "to be ported" as I need to transfer this work to the 5.x and 7.x branch.
Comment #70
Shadlington commentedSubbing.
Comment #71
koppie commentedSubscribing.
Comment #72
nicholasthompsonThis is now committed to dev on 7.x-2.x and 6.x-2.x. 5.x-2.x is no longer supported.
If there are any further issues (bugs or features), please can they go in a separate/new issue.