Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2019-05-18 00:08:01

agovella
Member
From: Houston, TX
Registered: 2005-05-01
Posts: 65
Website Twitter

Why are deeper URL patterns not allowed?

When you add a “/” in the article URL, it converts to “%2F”. If you add a “/” in the section name, it converts to a hyphen (“-”).

In Txp, it’s not possible to create URLs with multiple sub-directories like this: /en/about/history/first-10-years

Does anyone know why?

I assume Txp converts the slashes for a reason.

Last edited by agovella (2019-05-18 00:08:44)

Offline

#2 2019-05-18 04:11:10

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: Why are deeper URL patterns not allowed?

I commented about this here. The problem is not if the slashes are parsed in the url. The problem in my view is that there is no way to reflect those sub-directories in the structural taxonomies of sites.

That is, txp would (if slashes were allowed) list all articles allocated to a section, regardless of its URL-only title. The idea of sub-sections was discussed here a number of times and I would also very much like to see it either structurally or in the way you propose, with the addition of GPS.

I believe that more flexibility in the url structures would solve multi-lingual sites but also a lot of other more personalised demands.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2019-05-18 10:26:05

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Why are deeper URL patterns not allowed?

Slashes are considered as directory entries by servers. If you create and try to access a sites/site1/private article, you will land inside the corresponding directory instead. Textpattern will not even have a chance to process the request — Apache will shoot first. Whence the slashes conversion, to avoid surprises.

Offline

#4 2019-05-18 16:04:03

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: Why are deeper URL patterns not allowed?

The problem with section names is that the section tab is not normally accessible to writers or, in other words, to the clients of txp designers.

From the beginning, sections had more to do with presentation rather than urls, although txp also allowed the allocation, listing of articles, and menu links. This confused state of what sections are, has been plaguing us since day one.

Backward compatibility no longer allows us to change this paradigm, be it a faulty one, but a built-in system which helps in the creation of static looking urls and the sub-listing of their articles would increase the flexibility of txp enormously.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2019-05-19 07:27:50

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: Why are deeper URL patterns not allowed?

agovella wrote #318086:

When you add a “/” in the article URL, it converts to “%2F”. If you add a “/” in the section name, it converts to a hyphen (“-”).

In Txp, it’s not possible to create URLs with multiple sub-directories like this: /en/about/history/first-10-years

As a workaround, did you have no luck with rah_pathway (compiled installer here) as discussed here where you asked a similar question. It doesn’t give you the structural depth, but you can use it to produce URLs of the kind you mention.


TXP Builders – finely-crafted code, design and txp

Offline

#6 2019-05-27 18:52:11

agovella
Member
From: Houston, TX
Registered: 2005-05-01
Posts: 65
Website Twitter

Re: Why are deeper URL patterns not allowed?

jakob wrote #318112:

As a workaround, did you have no luck with rah_pathway (compiled installer here)

I saw that, and it looked like it would do the trick.

I did not install because I am trying to stay away from plugins this go around. I may shift my stance, but for now, I’m just working with what I have.

Offline

#7 2019-06-15 06:00:35

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: Why are deeper URL patterns not allowed?

jakob wrote #318112:

As a workaround, did you have no luck with rah_pathway (compiled installer here) as discussed here where you asked a similar question. It doesn’t give you the structural depth, but you can use it to produce URLs of the kind you mention.

I’m reviving this thread to ask if there are any plans to produce deeper permlink structures for the next txp. I am asking as we are planning a big project next year which will require /section/project_title/ and under that /section/project_title/sub-project/ followed by /section/project_title/sub-project/title urls. I am quoting jakob’s link in order to confirm that I am aware of the plugin but as we prefer to use the vanilla install (as much as possible). If not, we might have to create yet another subdomain which we are also trying to avoid.

Alternatively is there a way to get

  • /section_title/category_title/
  • /section_title/category_title/sub_category_title/
  • /section_title/category_title/sub_category_title/title

type urls?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#8 2019-06-15 08:59:22

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: Why are deeper URL patterns not allowed?

While not an answer to the question about the core, some loose ideas, all of which will require a plugin of sorts.

A lot depends on what you want to have available under each level of your tier. For instance, whether you need articles attached to each organisational level or only in the last tier. Having articles available at each level means you need some way of differentiating whether the current url stub is a category or an article. Traditionally that has been done with some kind of extra indicator in the url, e.g. /category/ or ?c= but if you need a more natural sounding word, you can easily use .htaccess to have topic (or whatever) in your url instead of category.

If you think you need articles in order to provide some intro text on the intermediate landing pages for a bit of intro text above a section/category list, you may be able to make use of the category/section description. If you need a custom image, I have a mini plugin to add a category/section custom field which you can use to hold an image ID.

Other ideas:

  1. Fashion a section/category/title url structure and then use rah_pathway for the final two-tier sub-project/ and sub-project/title part. This assumes that not a lot happens at the third tier of the url, other than it being an introduction to the sub-project.
  2. Use .htaccess to recognise the permitted category urls and respond to them as categories. This allows you to get around the trigger word but you need to hard code the list of projects in your htaccess file (like this (project-a|project-b|project-c)). That’s perfectly doable if your project structure is fairly predictable.
  3. Create or ask a talented programmer to create a plugin for your custom url scheme. Textpattern provides a hook for pretext that you can use to dissect the incoming url and allocate the respective parts to the relevant bit of textpattern’s structure. Again, here you need to know what is supposed to happen at each level. This is in essence what gbp_permanent_links did but it gave you a whole lot of options. If you only need one particular url scheme, the whole huge plugin can be reduced to a simpler plugin that re-routes your chosen incoming url to txp’s organisation. You’ll need to fashion your own permlinks in your templates but that’s not hard.

TXP Builders – finely-crafted code, design and txp

Offline

#9 2019-06-15 15:57:04

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: Why are deeper URL patterns not allowed?

jakob wrote #318478:

While not an answer to the question about the core, some loose ideas, all of which will require a plugin of sorts.

A lot depends on what you want to have available under each level of your tier. For instance, whether you need articles attached to each organisational level or only in the last tier. Having articles available at each level means you need some way of differentiating whether the current url stub is a category or an article. Traditionally that has been done with some kind of extra indicator in the url, e.g. /category/ or ?c= but if you need a more natural sounding word, you can easily use .htaccess to have topic (or whatever) in your url instead of category.

I’m actually struggling with the htaccess now!

If you think you need articles in order to provide some intro text on the intermediate landing pages for a bit of intro text above a section/category list, you may be able to make use of the category/section description. If you need a custom image, I have a mini plugin to add a category/section custom field which you can use to hold an image ID.

The problem `i am facing is that all levels will require a text and their own images.

After deleting three different paragraphs trying to describe our issue in real life situation, I thought the best way would be to ask you to visit our R! site. One of the reasons it resides in a subdomain is because I could not achieve the url depth needed for that project to go under our events menu as it needed another two levels of identification. ie events/respublika/projects/title, where all levels required a landing page at least .

For our project next year I expect us to need a similar structure but as I said earlier, I am trying to achieve this without a plugin.

Other ideas:

  1. Fashion a section/category/title url structure and then use rah_pathway for the final two-tier sub-project/ and sub-project/title part. This assumes that not a lot happens at the third tier of the url, other than it being an introduction to the sub-project.
  2. Use .htaccess to recognise the permitted category urls and respond to them as categories. This allows you to get around the trigger word but you need to hard code the list of projects in your htaccess file (like this (project-a|project-b|project-c)). That’s perfectly doable if your project structure is fairly predictable.
  3. Create or ask a talented programmer to create a plugin for your custom url scheme. Textpattern provides a hook for pretext that you can use to dissect the incoming url and allocate the respective parts to the relevant bit of textpattern’s structure. Again, here you need to know what is supposed to happen at each level. This is in essence what gbp_permanent_links did but it gave you a whole lot of options. If you only need one particular url scheme, the whole huge plugin can be reduced to a simpler plugin that re-routes your chosen incoming url to txp’s organisation. You’ll need to fashion your own permlinks in your templates but that’s not hard.

My efforts are currently focused on htaccess where I did not even manage to achieve the section-title/category-title/title schema.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#10 2019-06-16 16:31:37

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: Why are deeper URL patterns not allowed?

My efforts are currently focused on htaccess where I did not even manage to achieve the section-title/category-title/title schema.

I find it very hit and miss too, but try something like this:

RewriteRule  ^(produce)/(fruit|vegetables)/?$  index.php?s=$1&c=$2 [L]
RewriteRule  ^(produce)/(fruit|vegetables)/(.+)$  /$1/$3

where (fruit|vegetables|sweets|drinks|etc) are the names of the categories that need recognising. On the second line, you might have to make the rewrite destination as follows: https://www.neme.org/$1/$3. Also, I’m not sure whether you need an [R] flag at the end but I think you don’t want your url to change so I presume that’s not actually needed.

That should make:

/produce/fruit/           section = produce and category = fruit
/produce/vegetables/      section = produce and category = vegetables

and then skip the second rule (the [L] meaning this is the last rewrite directive). And:

/produce/fruit/apples          /produce/apples
/produce/fruit/pears           /produce/pears
/produce/vegetables/cucumber   /produce/cucumber
/produce/vegetables/lettuce    /produce/lettuce

See if that works in a test case. I tried them at this htaccess Tester and the right rules were met in each case.

I’ve no idea whether this plays well with rah_pathway or messes with it’s own redirect. I guess you need to experiment with that. The custom plugin method may still be the best way to go about it.


TXP Builders – finely-crafted code, design and txp

Offline

#11 2019-06-17 07:32:31

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: Why are deeper URL patterns not allowed?

Just checking in to thank you and let you know that I am still trying. After a few failed attempts I am actually rethinking about Jukka’s plugin with which I allocate the “url_title” field as the “Free-form article URL field”. It works seamlessly but does not solve the problem of how to collate the articles.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB