Closed (won't fix)
Project:
Pathauto
Version:
6.x-2.x-dev
Component:
Code
Priority:
Minor
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
14 May 2010 at 22:57 UTC
Updated:
17 May 2011 at 22:49 UTC
I am using taxonaomy menu with pathauto and I have checked the "Use 'all' at the end of URL" for the taxonomy menu term.
However the url that is generated is not passing through path auto. I receive:
"http://www.example.com/taxonomy/term/1/all"
When i would rather have:
"http://www.example.com/taxonomyalias/termalias/pagealias.html"
I can do it manually but that is not practical on a large website.
Can this be done in pathauto automatically with bulk generate? And if Not I official put a feature request in.
Comments
Comment #1
spgd01 commentedno one else wants to auto generate a auto path for term/all?
Comment #2
gregglesNo, this is apparently a low priority...
Comment #3
dave reidComment #4
dave reidVocabularies don't have pages, so remove that from the title. Considering D7 removed the /all, I don't see this happening at all in Pathauto. As such, I'm moving this from a feature request to a support request.
Comment #5
spgd01 commentedThanks for the help. So if "list all" is not a good Idea then how do I list all the Terms' pages within a Vocabulary on one page then? And then how do I navigate "link" to it with a proper URL as described above? Taxonomy menu links to "all"
Comment #6
pedro7 commentedI have a temporary solution for this issue (on postgresql). I don't know if it's applicable to other databases.
The solution is to create a trigger - function, which is called every time the table url_alias is updated. This function duplicates rows with src field 'taxanomy/term/TID' with 'taxanomy/term/TID/all'. Also duplicated the corresponding dst field.
How to create the function and trigger (again, in Postresql!):
CREATE OR REPLACE FUNCTION SCHEMANAME.taxtermall()
RETURNS trigger AS
$BODY$
begin
create temp table taxterm as (select src,dst,language from SCHEMANAME.url_alias where substr(src,1,14) = 'taxonomy/term/');
delete from taxterm where substr(src,1,14) = 'taxonomy/term/' and substr(src,char_length(trim(src))-2,3) = 'all';
delete from SCHEMANAME.url_alias where substr(src,1,14) = 'taxonomy/term/' and substr(src,char_length(trim(src))-2,3) = 'all';
update taxterm set src = src || '/all',dst = dst || '/all';
insert into SCHEMANAME.url_alias (src,dst,language) select src,dst,language from taxterm;
drop table taxterm;
RETURN NULL;
EXCEPTION
WHEN duplicate_table THEN
RETURN NULL;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION SCHEMANAME.taxtermall() OWNER TO MYOWNER;
Create the trigger:
CREATE TRIGGER SCHEMANAME_taxtermall AFTER INSERT OR UPDATE ON SCHEMANAME.url_alias
FOR EACH STATEMENT EXECUTE PROCEDURE SCHEMANAME.taxtermall();
Please, replace strings SCHEMANAME and MYOWNER with your own, depending on your situation.
Now, update anything in url_aliases (for example, insert any url alias). The function will be automatically trigerred and table url_alias updated. You wil be, maybe, happy (as me) :-)
Nothing in drupal code should be modified.
Petr
Comment #7
dave reidI would recommend using something like custom_url_inbound_alter() and/or custom_url_outbound_alter() or Sub-path URL aliases.