Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#556 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

#557 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

#558 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

#559 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

#560 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

#561 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

#562 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

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

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
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

#564 2011-04-01 17:38:47

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

Re: gbp_permanent_links

They really needs to be a tutorial but there is one at present.

By the looks of of your RewriteRule it looks like you are trying to integrated with MLP, am I correct? In the last week I’ve done some work on MLP preparing for gbp_pl integration which might be what you are after…

Usually you won’t need to touch the “destination” settings unless you are doing something quite different.

When you say nothing meaningful what isn’t as you expect? Maybe send me some debugging output (see the gbp_pl preferences, set the production status to debugging then debug is outputted in an HTML comment) and I’ll see if I can help.

Offline

#565 2011-04-01 18:06:25

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

Re: gbp_permanent_links

graeme wrote:

By the looks of of your RewriteRule it looks like you are trying to integrated with MLP, am I correct?

Yes, the site already uses MLP with pomp, triumph, and reveling!

Usually you won’t need to touch the “destination” settings unless you are doing something quite different.

Okay, cool. It’s not clear what input is needed just looking at it. If I can figure out how the interface works, I’d be glad to write some contextual help messages that could appear “on focus”.

When you say nothing meaningful what isn’t as you expect?

Here’s an example of a section-specific category link without using any permanent link rules:

http://{site-url}/{l10n-lang}/{section-name}/?c={category-name}

That link was generated by this tag:

<txp:category link="1" section='<txp:section/>' title="1"/>

And when I go to that link, it shows me all the articles in the section tagged with the specified category and language code. My section landing page for that section has if_category conditionals to show a list of articles in the category context.

By comparison, if I enable gbp_permanent_links and create a new rule with the section/category/ schema, here’s what happens. The txp:category tag above generates a link like this:

http://{site-url}/{l10n-lang}/{section-name}/{category-name}/

That’s exactly what I wanted!

But when I click on that link, Textpattern acts like we’re not on a category page— it shows the section landing page as if the if_category conditional evaluated as false.

Maybe send me some debugging output (see the gbp_pl preferences, set the production status to debugging then debug is outputted in an HTML comment) and I’ll see if I can help.

Do you think the debugging info would help? I just thought I didn’t understand how to use the plugin and I was doing it wrong, but if you want the debugging info I can post it.

Thank you!

Edit: Fix textile.

Last edited by johnstephens (2011-04-01 18:07:17)

Offline

#566 2011-04-12 06:27:29

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 305
Website GitHub Twitter

Re: gbp_permanent_links

Hello,
I´m using MLP with three languages and I wonder if it is possible to replace the slash after the language code with a underscore or a dash by using gbp_permanent_links with some modifications?
Would be interesting for SEO to have urls like en_article_title or en-article_title instead of en/article_title.
Thanks for any hint …

Offline

#567 2011-04-18 16:50:57

beechy
Member
Registered: 2006-03-02
Posts: 92

Re: gbp_permanent_links

Hi I am using gbp_admin_library 0.4.669 and gbp_permanent_links 0.14.7.

I have just updated to Textpattern 4.4.0.

Everything was working fine on the previous version of textpattern. However after the upgrade to 4.4.0

gbp_permanent_links/textpattern no longer seems to recognise categories using clean urls when I am on a category page i.e www.websitename/blog/category-name

<txp:category/> shows nothing and <txp:if_category> does not work when I’m on a category page that has a gbp_permanent_links redirect setup. Both <txp:if_category> and <txp:category/> work fine on the actual article page. Has anyone else experienced this?

I have the usual – section/category/title/ redirect setup

so my blog articles now show as /blog/category/article-name

Thanks in advance.

Last edited by beechy (2011-04-18 17:20:25)

Offline

#568 2011-04-18 20:03:35

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: gbp_permanent_links

Does this help?

Offline

#569 2011-04-18 20:06:31

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

Re: gbp_permanent_links

I solved this problem by using .htaccess Rewrites instead of gbp_permanent_links.

Offline

#570 2011-05-26 22:25:09

oliverker
Plugin Author
From: Huddersfield
Registered: 2008-07-14
Posts: 90
Website

Re: gbp_permanent_links

johnstephens wrote:

I solved this problem by using .htaccess Rewrites instead of gbp_permanent_links.

Care to share John?

Im trying to use gbp_permanent_links and MLP together, all works kind of ok, until I try switch languages (english to french) using <txp:l10n_lang_list/> where it changes the the url apart from the language slug.

So I have

Site.com/en/{section}/{category}/English-title

but trying to change lanuage it links to

Site.com/en/{section}/{category}/French-title — instead of — Site.com/fr/{section}/{category}/French-title

which returns a 404, swaping the en to fr does work but have to do it manually or go back to the home pacge click the link to fr and follow the links again…

Any help appreciated.

Offline

Board footer

Powered by FluxBB