Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#553 2010-12-08 05:32:08

mericson
Member
Registered: 2004-05-24
Posts: 137
Website

Re: gbp_permanent_links

Els wrote:

Since Txp 4.3.0: using the standard section/category/title rule, going to a section/category URL made <txp:if_category> return false (see post JanDW).

I’m encountering the same problem, anyone investigating a patch? I sure hope I don’t have to go through my site pages and forms to accomplish the workaround.

Offline

#554 2010-12-08 05:57:19

radneck
Plugin Author
Registered: 2005-07-03
Posts: 109

Re: gbp_permanent_links

mericson wrote:

I’m encountering the same problem, anyone investigating a patch? I sure hope I don’t have to go through my site pages and forms to accomplish the workaround.

Well I’ve been using this replacement for if_category.
Install, activate and replace instances of <txp:if_category></txp:if_category> with <txp:esq_ifcategory /></txp:esq_ifcategory>.

Bit of a hack, but works for me (I’m using /section/category/title).

No guarantee, but let me know how you go.

Last edited by radneck (2015-11-04 07:41:59)

Offline

#555 2010-12-08 06:27:04

mericson
Member
Registered: 2004-05-24
Posts: 137
Website

Re: gbp_permanent_links

cain-mi wrote:

Well I’ve been using this replacement for if_category.
Install, activate and replace instances of <txp:if_category></txp:if_category> with <txp:esq_ifcategory /></txp:esq_ifcategory>.

I realized that I could accomplish the same with a plugin I already have installed, smd_if and it works around the issue also.

Odd and frustrating that the gbp_permanent_links breaks standard tag if_category, but not this plugin tags that you would think are doing the same thing.

Offline

#556 2010-12-08 06:37:14

radneck
Plugin Author
Registered: 2005-07-03
Posts: 109

Re: gbp_permanent_links

mericson wrote:

Odd and frustrating that the gbp_permanent_links breaks standard tag if_category, but not this plugin tags that you would think are doing the same thing.

I think it only stopped working with the update from 4.2.0 to 4.3.0 due to some deprecated functionality in TXP.
The plugin I posted is essentially the same as the core functionality, but still checks the deprecated variable (can’t be sure, but IIRC $pretext[‘c’]) as well.

gbp_pl didn’t break it, it just doesn’t fix (for want of a better word) it with 4.3.0.

Its my (vague) understanding that a new version of this plugin is being worked on at the moment, not sure when it will be released however.

Offline

#557 2010-12-17 18:55:49

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: gbp_permanent_links

Quick tip:
you can recreate the smd_short_url functionality just creating, at least, two rules with gbp_permanent_links.

These tutorial is based in that you use/like the /section/title/ style of permanent links, but it should work for other URL schemes too.
Here are the steps:

1) Build a permanent link rule with just the section/ and title/ components. Under the “Settings” panel, name it: Z: basic permlink.

Of course, you can use any other name you like. The important part is that it should begin with a Z (or any other letter that would put this rule at the very bottom on the list of permanent link rules).
This is because it seems that the name sorting of your permanent link rules have effect on how the rules are applied.
In any case, this should matter only if you have other redirects that may not get executed if this redirect we are creating comes first on the list of permanent link rules.

2) Build another permanent link rule. This time, there is just one component you need: id/. Now, to finish, On the “Destination” panel, you need to click on the “Permanent link” drop down menu (under Redirect this permanent link to…)
There, you have to select the permanent link we created in step 1 (Z:…). Save it.

That’s all!
Test it: if you visit an URL like http://www.example.com/5, you should be redirected to the correspondent permanent link (http://www.example.com/section/title) for that article.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#558 2011-02-10 06:02:09

jwoldan
New Member
Registered: 2011-02-10
Posts: 4

Re: gbp_permanent_links

Hi. I’m relatively new to Textpattern and trying to use this plugin to prevent overlapping URLs in a fairly simple URL scheme.

The scheme I’d like to use is /section/year/month/title- this ought to be sufficient to prevent any two articles with the same title from sharing the same URL. The problem I’m finding is that the URLs for two different articles with the same title, even in different months, are pointing to the same article content.

Is there a way to fix this?

In case these details help with a diagnosis: I’m currently using the /section/id/title permanent link mode in the standard Textpattern preferences, and to test this, I’ve manually set a timestamp to the past month on one of the articles. I’ve also been using the asy_jpcache plugin, but it’s disabled at the moment.

I’ve skimmed through a bunch of this thread and haven’t seen anyone addressing this issue, sorry if I missed it.

Any help would be much appreciated.

Offline

#559 2011-02-11 01:55:42

jwoldan
New Member
Registered: 2011-02-10
Posts: 4

Re: gbp_permanent_links

Just a quick followup to my last post- got some help from the folks on #textpattern today, and for the time being, I’m using the build-in /year/month/day/title scheme for a couple sections on the site, and using the plugin to implement /section/title for other, more static sections.

Still trying to figure out how to use the redirect feature.

I’d love to customize more if the plugin could handle multiple articles with the same url-title better.

Offline

#560 2011-02-13 03:50:20

jwoldan
New Member
Registered: 2011-02-10
Posts: 4

Re: gbp_permanent_links

Ok, last post for now, but this is an exciting one: I’ve updated the plugin to support duplicate url-titles where a unique article can be determined by the date components of the URL. For example you could now have two articles as follows:

/section/2011/02/12/article
/section/2011/02/11/article

Previously the two permalinks would both map to the article content of only one of the two articles.

I’ve forked Graeme’s code on github, and I hope he can incorporate my code into the master, but until then you can download mine here: https://github.com/jwoldan/gbp_permanent_links

I should note that my version also restricts access to the plugin to privilege levels one and two (Publisher and Managing Editor).

Offline

#561 2011-02-14 19:29:04

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: gbp_permanent_links

jwoldan:
thanks for sharing your findings and the codez too.
Being that you studied gbp_p_l code, do you think that, eventually, this feature you developed could be extended to other ways of disambiguating two articles with the same url_title?

In other words, to have something similar to what you did for dates, but applied to other components, most precisely, for components like section/, or category1/category2?

Thanks.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#562 2011-02-15 01:47:59

jwoldan
New Member
Registered: 2011-02-10
Posts: 4

Re: gbp_permanent_links

I haven’t tested it, but based on my understanding of the code, gbp_p_l should already do this, as long as the disambiguating section and/or categories appear to the left of the title in the URL.

My version should do the same, but allow the title to appear anywhere in the URL, even to the left of the disambiguating components.

Let me know if you try it out.

Offline

#563 2011-02-21 14:58:23

graeme
Plugin Author
Registered: 2004-06-21
Posts: 337
Website

Re: gbp_permanent_links

I have reviewed and committed jwoldan’s changes. New download links:

Offline

#564 2011-04-01 16:55:42

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: gbp_permanent_links

Is there a primer or tutorial for this plugin? I don’t understand how the interface works, and the questions I’ve seen here are too advanced for me.

As a starting point, I have some experience with .htaccess rewrite rules. So I might set something like this in my .htaccess file, replacing the parts in curly brackets with actual data:

RewriteRule ^{l10n-lang}/{section-name}/{category-name}?$ ?{l10n-lang}/index.php?s={section-name}&c={category-name}

I don’t know how to do this dynamically in .htaccess, though, and I thought gbp_permanent_links would be able to do it. But I don’t know where to start. I started building a new “permanent link rule” and set up a section/category/ URL structure. For “destination”, I didn’t know what to put.

When I saved the rule and looked at the site, I could see that all section-specific category links were being generated with {site_url}/{section-name}/{category-name} URLs, but those links weren’t pointing to anything meaningful, and I’m lost. Does anyone know of any primers or tutorials that can get me up to speed, so that I can ask an intelligent question here?

Thank you!

Offline

Board footer

Powered by FluxBB