Hi,
I've got a site structure in development that uses the same sub-category name across categories. Eg:
- Climate change
- Our Work
- Science
- Health
- Our Work
- Science
- Oceans
- Our Work
- Science
Unique basenames mean that my URLs for categories will wind up looking like:
/climate-change/our-work/
/health/our-work-1/
/oceans/our-work-2/
That's messy! How have people dealt with this problem more elegantly?
Thanks,
Erika
Reported on Movable Type 4.3
>Hi, thirteencentpinball
The directory name of category archive is determined by "CategoryBasename".
http://www.movabletype.org/documentation/appendices/tags/categorybasename.html
This value must be unique, so you cannot use same category name for directory.
(You can use same category name inside html source because it comes from "category label")
http://www.movabletype.org/documentation/appendices/tags/categorylabel.html
You can change your "category basename" from dashboard to
manage -> categories
and click category name.
Then you will find "basename" form so change that after clicking "key" icon.
Thanks, Nick, I'm aware of all that. The unique basename poses a problem for this kind of site structure... I'm looking for solutions that won't give me messy URLs.
Erika
>Hi, thirteencentpinball
After that, I happen to remember the way resolve your matters.
How about using "replace" modifier?
http://www.movabletype.org/documentation/appendices/modifiers/replace.html
http://www.movabletype.org/documentation/appendices/modifiers/regex-replace.html
Your categories have a "-1" or "-2" basename, so change their name to some words or numbers, then replace them in your archive mapping.
You can use mt-tag in your publishing file name in your archive templates.
Ordinary, you have a "category/subcategory/index.html" in your category-list archive template.
So change it to "custom", then you'll find "%c/%i". "%c" is equal to " <$mt:SubCategoryPath$>" and you can replace it to the mt-tag.
http://www.movabletype.org/documentation/appendices/tags/subcategorypath.html
Within that tag, you can use "replace" modifier.
For example,
<$mt:SubCategoryPath replace="-1","" $>
Then, an archive map value might be like this;
<$mt:SubCategoryPath replace="-1","" $>/%i
Please give it a shot when you have a time.
Brilliant, I'll see if that works. Thanks so much.
Nick, I just tried this with an entry publishing path and it didn't work.
For the categories I simply renamed them to remove the _1 and it didn't cause a fuss. But I'm using a custom index in the place of some category indexes, so except where I customized the path with if statements (which worked) to add an /hidden to my URLs, I used _1 deliberately in certain category basenames. It affects the entry and I didn't anticipate needing to use entries in that category. Can't seem to make it work either way...
Update: Where I used _1 deliberately (so category indexes could be replaced with custom indexes without the former overwriting the latter), to correct the entry publishing path I changed it to: