Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-11-18 18:23:02
- element
- Member
- Registered: 2009-11-18
- Posts: 99
Static pages
Hello,
I’m in the process of building a website with txp, obviously. It’s a plain website with several sections, so it’s made up of all static pages
Question:
How can I make a link in an article in a static page from a certain section to another article, also static and part of that same section?
Offline
Re: Static pages
If you have this in your page template for your section:
<txp:if_individual_article>
<txp:article />
</txp:if_individual_article>
Because you specified, the <txp:article /> tag will display an individual article.
When editing an article notice the view link near the title field. That will tell you the link you can use to that article. Under Admin > Preferences you can set the way URLs are built which can help you get pretty urls if you like.
You can use textile to make a link to that article from another article. Write the following in your article you have the link in: "link text":http://yoursite.com/yoursection/name-of-article See the Textile Help under the Write tab.
If you need to display more articles then one then the default template TXP came with should be doing that for you already and so "link text":http://yoursite.com/yoursection/name-of-article is all you’ll need to know. The default template will also handle displaying a single article at a time.
Last edited by whaleen (2009-11-19 02:01:49)
txtstrap (Textpattern + Twitter Bootstrap + etc…)
Offline
#3 2009-11-18 20:44:39
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Static pages
You can also link to another article like this:
<txp:permlink id="123">link text</txp:permlink>
Offline
#4 2009-11-18 21:13:55
- gerhard01
- Plugin Author
- Registered: 2006-12-07
- Posts: 108
Re: Static pages
And wet_quicklink might speed up this process in case you would need internal linking on a frequent basis.
Offline
#5 2009-11-18 23:18:32
- element
- Member
- Registered: 2009-11-18
- Posts: 99
Re: Static pages
Whaleen:
With this solution the page is empty. Don’t see any article.
Last edited by element (2009-11-18 23:38:03)
Offline
#6 2009-11-19 00:42:58
- uli
- Moderator

- From: Cologne
- Registered: 2006-08-15
- Posts: 4,319
Re: Static pages
Just add a slash and thus make the last line a closing tag.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Static pages
uli wrote:
Just add a slash and thus make the last line a closing tag.
<txp:if_individual_article> to </txp:if_individual_article> on the closing tag. Sorry I left that out.
txtstrap (Textpattern + Twitter Bootstrap + etc…)
Offline
#8 2009-11-19 09:45:38
- element
- Member
- Registered: 2009-11-18
- Posts: 99
Re: Static pages
I already saw that one. I have this:
<div id="content">
<txp:if_individual_article>
<txp:article />
</txp:if_individual_article>
</div>
But no article is shown on the page, completely empty.
A tag trace shows <txp:if_individual_article> returning a false. Why?
Last edited by element (2009-11-19 10:50:29)
Offline
#9 2009-11-19 11:08:41
- element
- Member
- Registered: 2009-11-18
- Posts: 99
Re: Static pages
This seems to work (or at least do what I want):
<txp:if_individual_article>
<txp:article />
<txp:else />
<txp:article limit="1" sort="Posted asc" />
</txp:if_individual_article>
Maybe there’s a better way to become the same result?
Offline
#10 2009-11-19 17:23:05
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Static pages
element wrote:
A tag trace shows
<txp:if_individual_article>returning a false. Why?
Then it can’t be an individual article page. If you are linking to a section page (/site.com/section-name/) and you only want to show one article, you don’t need the if_individual_article tags, just use <txp:article limit="1" sort="Posted asc" />.
Offline
#11 2009-11-19 21:08:21
- element
- Member
- Registered: 2009-11-18
- Posts: 99
Re: Static pages
What is an individual article page exactly? How does it differ from a section page?
Offline
#12 2009-11-19 23:38:02
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Static pages
An individual article page has the article id and/or title (depending on your permanent link mode) in the URL. A section page has only the section name in the URL, and is by definition an article list (even if you choose to display only one article).
Offline
#13 2009-11-19 23:52:40
- element
- Member
- Registered: 2009-11-18
- Posts: 99
Re: Static pages
I’m a bit confused.
I had it in my preferences set to /section/id/title. I changed it to /section/title. Does this mean that any article without a title is a section page and any article with a title is an individual article page? It only seems normal behaviour to give every article a title.
Very confusing to me, in my case now:
www.domain.com/contact/ is exactly the same as www.domain.com/contact/contact/ because the contact page is in the section contact and has the title contact.
Last edited by element (2009-11-19 23:58:59)
Offline
#14 2009-11-20 01:39:12
- uli
- Moderator

- From: Cologne
- Registered: 2006-08-15
- Posts: 4,319
Re: Static pages
element wrote:
/contact/contact
Yup, that’s not desirable. Two ways to work around:
a) Chose /title as URL scheme.
b) At least in the case of the contact page you could put your contact form and/or text immediately onto the page, not in an article.
(Note: I don’t know how many sections, pages, articles your site has, i.e. if any of that is viable.)
Does this mean that any article without a title is a section page […]
No, each article is an article ;) But if you chose to post it without a title its permlink would lead to a section page, namely the section the article is published to (a clean URL scheme provided). Because the URL-only-title field stayed empty the article only had the section as its URL. And here we’d have a not so viable solution c (in case the section would hold only one article)
Edit Oh, there’s of course solution d: From your section Contact don’t link to your article Contact (by enclosing your contact page elements with <txp:if_article_section name="contact"> so they’re output only there.)
and any article with a title is an individual article page?
No. Each page with an article title as the last element in the URL (again: clean URL scheme) is an individual article. Or (another way to say it): any article’s permlink opens an individual article page.
Last edited by uli (2009-11-20 01:56:00)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#15 2009-11-20 16:26:59
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Static pages
uli wrote:
But if you chose to post it without a title its permlink would lead to a section page, namely the section the article is published to (a clean URL scheme provided). Because the URL-only-title field stayed empty the article only had the section as its URL. And here we’d have a not so viable solution c
Hey Uli, if it really works like that (never tried it myself), it looks like you found a workaround to prevent static articles (used only on the section landing page) from showing up as individual articles: just leave the title field blank :) Easier than setting up a redirect in .htaccess… Of course it would only work for one article per section.
(in case the section would hold only one article)
I think it should also work if a section has more than one article (provided the other articles are not meant to be static).
Offline