Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-10-31 02:13:45

speeke
Member
From: Bruny Island, Australia
Registered: 2009-03-29
Posts: 161
Website

Write tab title view link error ? (static pages)

I have created a static page – eg: http://domain.com/about/.

When I click on the “View” link to the right of the Title field in the Write tab of the Admin, I get directed to: http://domain.com/about/about instead.

Is this a known bug, or am I setting up the static page incorrectly? I’ve followed the procedure in the book “Textpattern Solutions” (Chapter 9, pg 208).


“People who value their privileges above their principles soon lose both.”
Dwight D. Eisenhower

Offline

#2 2009-10-31 02:33:31

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: Write tab title view link error ? (static pages)

Is both your section and the article named “about” and you’ve set the Permanent Link Mode (in Admin > Basic Preferences) to “/section/title”?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#3 2009-10-31 03:55:29

speeke
Member
From: Bruny Island, Australia
Registered: 2009-03-29
Posts: 161
Website

Re: Write tab title view link error ? (static pages)

Uli,

Yes, that’s correct.


“People who value their privileges above their principles soon lose both.”
Dwight D. Eisenhower

Offline

#4 2009-10-31 07:52:47

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

Re: Write tab title view link error ? (static pages)

When I click on the “View” link to the right of the Title field in the Write tab of the Admin, I get directed to: http://domain.com/about/about instead.

That’s expected behaviour. It’s showing you a page called /about in the section named /about.

I have created a static page – eg: http://domain.com/about/.

This is actually a section rather than a page. If I recall correctly, you can’t create pages in the default section.

Two options:

  • If you have a very simple site you can set Permanent Link Mode to just “title”.
  • If your site is more complex than that, you make your page template for the about section show an individual article as standard (rather than a list) and build your navigation to link to /about where it will automatically show the about page.

Your view button on the backend will still show the link you mention but you can at least handle the front end differently.


TXP Builders – finely-crafted code, design and txp

Offline

#5 2009-10-31 11:26:25

speeke
Member
From: Bruny Island, Australia
Registered: 2009-03-29
Posts: 161
Website

Re: Write tab title view link error ? (static pages)

Jakob,

Thanks for your reply.

My bad, I have a section called about (rather than a page). Of the two options you mentioned, I’ve used the latter.

Given the backend link is expected behaviour, I guess there’s nothing else to do. I just thought it may have been an error. Good to know.

Cheers.


“People who value their privileges above their principles soon lose both.”
Dwight D. Eisenhower

Offline

#6 2009-10-31 16:32:51

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

Re: Write tab title view link error ? (static pages)

If you set up your page template correctly, it really doesn’t make any difference on the front end. Where it may make a difference is in rss-feeds or google sitemaps:

  • An rss-feed is not really needed for an about page so unlikely to be a problem.
  • You can get around the google sitemap problem if you use rah_sitemap to generate a google sitemap. The plugin allows you to exclude certain sections/categories and to include custom urls in your google sitemap. With that combination you can avoid google picking up on the /about/about link.

TXP Builders – finely-crafted code, design and txp

Offline

#7 2009-10-31 17:23:54

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Write tab title view link error ? (static pages)

To add jakob’s great advice (especially the rah_sitemap thingy ;) wink wink), you can also kill the invididual article context of the About -article. That can by done either by redirect or by using <txp:txp_die />.

For example you can put something along lines:

<txp:if_invidual_article>
	<txp:txp_die />
</txp:if_individual_article>

Into your article form markup (or article itself). That way, if someone accidently ends up to /about/about article, it will show 404 error message using your TXP’s error page template.

Offline

#8 2009-10-31 17:32:40

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

Re: Write tab title view link error ? (static pages)

Gocom wrote:

<txp:if_invidual_article>
	<txp:txp_die />
</txp:if_individual_article>

Great tip, thanks! Never thought of using txp_die for it :)

Offline

#9 2009-10-31 17:46:43

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,454
Website GitHub

Re: Write tab title view link error ? (static pages)

Yes, good txp_die tip if you don’t mind a 404 on the occasion someone finds your individual article. Thanks Gocom, never thought of that.

As an alternative — or additional — safety net for search engines you may also consider employing the canonical link tag, e.g.:

<link rev="canonical" href="<txp:site_url />about" />

Or, if you want use it in your Page template in more than one static section you might try:

<txp:if_section name="about, contact, blahblah">
   <link rev="canonical" href="<txp:site_url /><txp:section />" />
</txp:if_section>

The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#10 2009-10-31 18:34:54

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

Re: Write tab title view link error ? (static pages)

The many ways of “attaching” some content to a section frontpage always lead to some win/lose situations.

  • If you just hardcode the content on the page template or a form:
    • - you lose the ability of easily handling the editing to the end user.
    • - it becomes content non-searchable by TXP built-in search
    • + you don’t have to worry (it’s more an OCD worry) about the content having a individual_article permalink.
  • If you use an sticky article, you
    • + make it easier for end users to edit the “section frontpage” content
    • - have to do some some extra-dance if you want the content to be searchable by TXP built-in search
    • - and if you make it searchable, you have to worry (another OCD worry) about the search result displaying a permlink for the sticky (ie. /about/about)
    • - not easy to include the sticky article on an article list (mainly, because you can’t do status="live,sticky"). An even if you do, then you have to worry about the /section/section permlinks.
  • if you use a live article + custom_field to fetch it and/or filter it (txp:article custom_field_name="value" and txp:article_custom custom_field_name="", respectively)
    • + you can have some extra flexibility as now you also have if_custom_field available to do nasty things.
    • - you still have the problem of having a permlink to the article somewhere
    • + it’s searchable without having to rely to extra attributes (searchsticky)

Gocom’s and Bloke’s suggestion and tips are both great, although they demand some custom/specific coding that may become hard to maintain…

On this matter, it seems to be all about compromises…


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#11 2009-10-31 19:52:37

speeke
Member
From: Bruny Island, Australia
Registered: 2009-03-29
Posts: 161
Website

Re: Write tab title view link error ? (static pages)

Great info, thanks to you all. Your comments have helped clear things up a bit for me.

@maniqui, I notice that you said a sticky article requires some extra-dance to make the content searchable, and I have another post to which someone also suggested that I need to use searchsticky. Can you please enlighten me as to how?

Update: This problem appears to have been solved.

Last edited by speeke (2009-11-01 05:30:57)


“People who value their privileges above their principles soon lose both.”
Dwight D. Eisenhower

Offline

#12 2009-10-31 21:00:36

speeke
Member
From: Bruny Island, Australia
Registered: 2009-03-29
Posts: 161
Website

Re: Write tab title view link error ? (static pages)

I’ve added the following to the .htaccess file in the root:

Redirect permanent /about/about http://domain.com/about/

Along with the excellent rah_sitemap ;) as suggested. I guess this should solve the problem for search engines and user input.

But, as was mentioned earlier, there is still the hassle of the search result url being: “http://domain.com/about/about” for example. Is there some way to customise this output with some fancy code?

It would be great to be able to do a check so see if the article is named “about”, “contact”, etc, and if so replace it with a link like: http://domain.com/article_name/ where article_name is the name of the relevant one-article section (about, contact etc).

Is this possible?

Last edited by speeke (2009-11-01 05:39:53)


“People who value their privileges above their principles soon lose both.”
Dwight D. Eisenhower

Offline

Board footer

Powered by FluxBB