Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Subsections, faux or otherwise
I fear this may be a dumb question, but I’ll ask it.
Can I achieve the following URL setup, with bonus points for it being purely in core (i.e. no plugins) and minimal httpd-specific rewrite voodoo:
https://example.com/london/about (landing page)
https://example.com/london/articles (article list)
https://example.com/london/events (article list)
https://example.com/london/map (landing page)
https://example.com/berlin/about (landing page)
https://example.com/berlin/articles (article list)
https://example.com/berlin/events (article list)
https://example.com/berlin/map (landing page)
I can have london and berlin as sections easily enough…but is there a magic route to have effective subsections with identical names (e.g. about, articles etc) as a landing page or a pure article list?
Any advice very warmly received. Thank you.
Last edited by gaekwad (Today 10:24:46)
Offline
Re: Subsections, faux or otherwise
Hmmm. If Berlin and London etc are sections, you’ll be allowed to make identically names articles “about” and “articles” and “events” etc for each section, but Txp will whinge about duplicate article names.
Since we don’t officially support subsections, you can’t have the last part of the URL be anything other than an article in /section/title permalink mode.
But you can fake it using breadcrumb permlink mode and assign your articles a category 1 of “articles” and “events” etc. But you will still have the article URL title after the category, which might not suit.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: Subsections, faux or otherwise
How are the rest of your articles, events etc. going to be stored?
If, for example, you store your events and articles in pageless sections and assign them the categories “london” and “berlin”, you can make your page template output the relevant lists, e.g.
<txp:if_individual_article>
<!-- regular page or intro paragraph for article list -->
<txp:title wraptag="h1" class="article-title" />
<txp:body wraptag="div" class="article-body" />
<!-- only for article or event list pages -->
<txp:article_url_title variable="this_page_name" />
<txp:if_variable name="this_page_name" value="events,articles" match="any">
<!-- article list: this_page_name = articles or events | txp:section = berlin or london -->
<txp:article_custom section='<txp:this_page_name" />' category='<txp:section />' form="article_list" />
</txp:if_variable>
</txp:if_individual_article>
TXP Builders – finely-crafted code, design and txp
Offline
Pages: 1