Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-09-17 10:20:59

Manaus
Member
From: Turin, Italy
Registered: 2010-10-22
Posts: 251
Website

Customizing article urls

Hi there,
I’m using a website for publishing workshops and so on, and since many of them do recur and have a similar name, urls often make conflict (there’s already 2 articles with the same name). How does the conflict solving works? It would be useful to create some urls like myworkshop-3984. I know I can enter it manually, I’d like to search some way of automation.

Thanks

Offline

#2 2014-09-17 10:55:09

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

Re: Customizing article urls

Try this one:

YToxMTp7czo0OiJuYW1lIjtzOjEzOiJhYmNfdXJsX3RpdGxlIjtzOjY6ImF1dGhvciI7czow
OiIiO3M6MTA6ImF1dGhvcl91cmkiO3M6MDoiIjtzOjc6InZlcnNpb24iO3M6MzoiMC4xIjtz
OjExOiJkZXNjcmlwdGlvbiI7czowOiIiO3M6NDoiY29kZSI7czo0NTM6InJlZ2lzdGVyX2Nh
bGxiYWNrKCdhYmNfdXJsX3RpdGxlJywgJ2FydGljbGVfcG9zdGVkJyk7DQpyZWdpc3Rlcl9j
YWxsYmFjaygnYWJjX3VybF90aXRsZScsICdhcnRpY2xlX3NhdmVkJyk7DQoNCmZ1bmN0aW9u
IGFiY191cmxfdGl0bGUoJGV2ZW50LCAkc3RlcCwgJHJzKQ0Kew0KCWV4dHJhY3QoJHJzKTsN
CglpZihjaGVja191cmxfdGl0bGUoJHVybF90aXRsZSkgPT09ICcnKSByZXR1cm47DQoJJHVy
bF90aXRsZSA9IHByZWdfcmVwbGFjZSgnL1wtXGQrJC8nLCAnJywgJHVybF90aXRsZSk7DQoJ
Zm9yKCRpID0gMTsgc2FmZV9jb3VudCgndGV4dHBhdHRlcm4nLCAidXJsX3RpdGxlID0gJyIu
KCRuZXdfdGl0bGUgPSAkdXJsX3RpdGxlLictJy4kaSkuIiciKTsgJGkrKyk7DQoJc2FmZV91
cGRhdGUoJ3RleHRwYXR0ZXJuJywgInVybF90aXRsZSA9ICckbmV3X3RpdGxlJyIsICJJRCA9
ICRJRCIpOw0KfSI7czo0OiJ0eXBlIjtzOjE6IjQiO3M6NToib3JkZXIiO3M6MToiNSI7czo1
OiJmbGFncyI7czoxOiIwIjtzOjQ6ImhlbHAiO2I6MDtzOjM6Im1kNSI7czozMjoiMjc4Njhk
MjIxY2NjM2FhZGU5ZWFhYjQ3ZjJjMzRiMjAiO30=

Edit: seems to work now. Note that it will reuse url titles of deleted (duplicated) articles.

Last edited by etc (2014-09-17 13:15:38)

Offline

#3 2014-09-17 11:37:16

Manaus
Member
From: Turin, Italy
Registered: 2010-10-22
Posts: 251
Website

Re: Customizing article urls

Works like a charm!!!
Thanks!!

Offline

#4 2014-09-17 12:52:56

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

Re: Customizing article urls

That’s weird, but it does not work for me as soon as I have 3 or more homonyms. Will check.

Offline

#5 2014-09-18 08:48:49

Manaus
Member
From: Turin, Italy
Registered: 2010-10-22
Posts: 251
Website

Re: Customizing article urls

Reached page-5 in my tests…

Offline

#6 2014-09-18 09:23:21

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

Re: Customizing article urls

Manaus wrote #283858:

Reached page-5 in my tests…

Yes, the latest version (above) works as intended. But there are two hypothetical issues:

  • an article named page-5 gets indexed by Google, and then you delete it. A new article could then be named page-5 by the plugin, and Google wont like it.
  • we could use article ID (producing page-ID) instead, this is better performance-wise too. But what if Apollo 13 is already published, with url=apollo-13, and now we want to publish Apollo with ID=13?

Any thoughts?

Offline

#7 2014-09-18 11:02:39

Manaus
Member
From: Turin, Italy
Registered: 2010-10-22
Posts: 251
Website

Re: Customizing article urls

Either you keep track of the article versions, or append an hash to the url, or prepend a letter [or some other symbol] to the version number, such as

  • page-v5
  • page5
  • page_5
  • page—5

Just tossing 2 cents coins into the bucket..

edit: what looks like superscript is surrounded by square brackets

Last edited by Manaus (2014-09-18 11:03:25)

Offline

#8 2014-09-18 20:33:16

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 684

Re: Customizing article urls

etc wrote #283859:

we could use article ID (producing page-ID) instead, this is better performance-wise too.

This isn’t clear to me: why it should have better performance?

Last edited by candyman (2014-09-18 20:33:52)

Offline

#9 2014-09-18 21:29:19

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

Re: Customizing article urls

candyman wrote #283866:

This isn’t clear to me: why it should have better performance?

Because ID is unique, so we (normally) don’t even have to check whether page-ID exists. Otherwise, the plugin queries the db for page-1 first, then for page-2 and so on, until it finds an unused page-n url_title. Many homonyms will thus yield many db queries (though it happens only on article creation).

Offline

#10 2014-09-19 05:37:15

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 684

Re: Customizing article urls

Thanks, now it’s clear. :) I thought that they involved even the live status.

I go slightly OT: a part an estetic reason there’s some advantage choosing the ?=messy permanent link mode instead of /section/title or the others?
I’m asking this ‘cause even if it’s the less beautiful to see the messy mode is the default one on the clean install (and the one you and other pros often choose).

I’ve always preferred the /section/title ‘caus I though it’s better for the google indexing.

Offline

#11 2014-09-19 15:06:57

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

Re: Customizing article urls

candyman wrote #283880:

I go slightly OT: a part an estetic reason there’s some advantage choosing the ?=messy permanent link mode instead of /section/title or the others?
I’m asking this ‘cause even if it’s the less beautiful to see the messy mode is the default one on the clean install (and the one you and other pros often choose).

I’ve always preferred the /section/title ‘caus I though it’s better for the google indexing.

I’m not a pro at all, but I don’t think it’s any better for seo. The only advantage I can see is that when you search in your browsers history, apollo is easier to remember than id=13. This said, seo has never really interested me.

Offline

#12 2014-09-19 19:34:08

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 307
Website GitHub GitLab Twitter

Re: Customizing article urls

A new article could then be named page-5 by the plugin, and Google wont like it.

Do not worry, Google likes fresh meat, not necessary by a new dish name or URL.

Offline

Board footer

Powered by FluxBB