Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2008-01-27 20:26:50
- azw
- Member
- Registered: 2007-01-29
- Posts: 279
Question about long static pages: parent & child pages or sub-pages
I’ve got a static page that is very long.
I’m thinking that it might be good to break it up into sub-pages or a parent article with associated child articles, so I’m considering how that might work and what problems might occur.
How to do it
I’ve not been able to find a parent – child article plug-in for Txp, but I think this could be achieved using the article tag by sorting on a custom field. The custom field would simply give the order for sorting the child articles (1, 2, 3, 4, etc.). (I suppose this page would no longer be a static page.)
Depending on how the attributes on the article tag are set, I could show either just the sub-page titles, or the titles with complete text.
Is there a better way to go about this?
Possible problems
Allowing comments on a child article would make viewing the comments a problem (if the child articles were all displayed on the partnt page). So child articles would not allow comments. All comments would have to be added to the parent article.
Are there other possible problems?
Advantages
The main advantages I see are ease of translating into different languages and more granularity in search.
I’m not 100% convinced this is a good idea. What do you think?
Last edited by azw (2008-01-27 20:29:39)
Offline
#2 2008-01-27 21:19:59
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Question about long static pages: parent & child pages or sub-pages
If you break the article into sub-articles and show each sub-article on it’s own page, won’t the relative context get lost?
Your idea about using article_custom for sub-articles is a good one I think, you could also use something like the Mootools Accordion plugin (demo) or another javascript to keep them on one page and still have a manageable page length.
Re the comments: if you’d display the parent article first, visitors would always have to return to that article to comment. Displaying the sub-articles inside the parent article is also possible, using an article_custom tag inside the parent article’s body:
Article body:
Some text.
Some more text.
<txp:article_custom limit="5" form="sub_article_list" />
(use section, status or whatever to select and sort)
Some more text to end with.
The comments would then appear at the end of the page. Article form ‘sub_article_list’ would contain the permlinked article title, and – if applicable – the article body in a div that is only displayed when the title is clicked (see the accordion demo).
Just an idea.
Offline
#3 2008-01-29 15:44:48
- azw
- Member
- Registered: 2007-01-29
- Posts: 279
Re: Question about long static pages: parent & child pages or sub-pages
Thanks for the ideas, Els.
I’ve been testing with the concept and run into what appear to be fatal flaws. The worst is that navigation is not intuitive. It seems that the better solution might be to use the usual article tag and sort on a custom field.
Even then, it looks like this combination of static and blog style leads to minor issues. For example, if the section URL takes you to the first article in that section, when you are on the second page, the link for the previous page will show the first article’s URL, not the section URL. Would that previous link have to be hard-coded with a conditional?
FWIW, I’m also thinking it would be helpful at the bottom of each page to display a titles-only link list of the articles in the section. Maybe your article_custom code would work for that.
Last edited by azw (2008-01-29 15:45:44)
Offline
#4 2008-01-29 17:53:37
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Question about long static pages: parent & child pages or sub-pages
azw wrote:
For example, if the section URL takes you to the first article in that section, when you are on the second page, the link for the previous page will show the first article’s URL, not the section URL. Would that previous link have to be hard-coded with a conditional?
You could have a look at wet_if_page or txp:if_article_id for page dependent article links.
Offline
#5 2008-01-29 17:54:06
- azw
- Member
- Registered: 2007-01-29
- Posts: 279
Re: Question about long static pages: parent & child pages or sub-pages
Okay, I’ll take a look.
Also, there are some plugins that might be really helpful, including this brand new one: soo_toc
That creates a table of contents from the heading tags in an article.
Last edited by azw (2008-01-29 17:56:08)
Offline