My Textpattern sections and page templates
Posted Jun 6, 2005 at 04:01 PM
When setting out to build a site, the most important task is determining the purpose for your site. Who are you hoping will visit your site? What are you going to provide them? Questions such as these will help determine how to best organize your site. Textpattern is very flexible along these lines, and it’s easy to get overly complex, which is usually a bad idea when you’re first starting out.
I tend to prefer simply structured and organized sites, and after a few weeks of exploration and experimentation, I decided that at least initially, I’d like my site to be organized primarily around articles. I wanted the front page to highlight my most recent articles, and to provide visitors with a clear overview of the structure of my site. Additionally, I wanted to provide an easy way to access all of the articles ever written, for both visitors searching for something specific and those just hee to browse. I also wanted a separate section strictly about me and how to reach me, and an area where I can manage bookmarks of favorite sites I visit again and again.
Additionally, I wanted to strive to make danboe.net a site that demonstrates web standards, and works predictably without scripting or stylesheets. This is great for accessibility, and lets me do things such as accessing my site on my cell phone.
Textpattern page templates
After a lot of trial and error, I finally broke my site down into the following page templates.
About
This is the page template I use for my about section.
<txp:output_form form="dtd" /><txp:output_form form="head" /><txp:output_form form="content_head" /><div id="content"><div id="area1"><div class="content"><txp:article form="about" limit="1" /></div></div><div id="area2"><div class="content"><txp:output_form form="search_form" /><txp:output_form form="about_area2" /><txp:output_form form="syndication" /></div></div></div><txp:output_form form="foot" />- Download this code: /code/textpattern/pages/about.txt
Archives
This is the page template I use for my archives section.
<txp:output_form form="dtd" /><txp:output_form form="head" /><txp:output_form form="content_head" /><div id="content"><div id="area1"><div class="content"><txp:output_form form="archives" /></div></div><div id="area2"><div class="content"><txp:output_form form="search_form" /><txp:output_form form="filter_archives" /><txp:output_form form="filter_categories" /><txp:output_form form="syndication" /></div></div></div><txp:output_form form="foot" />- Download this code: /code/textpattern/pages/archives.txt
Articles
This is the page template I use for individual articles on my site, such as the article you’re reading now.
<txp:output_form form="dtd" /><txp:output_form form="head" /><txp:output_form form="content_head" /><div id="content"><div id="area1"><div class="content"><txp:article /></div></div><div id="area2"><div class="content"><txp:output_form form="search_form" /><txp:if_individual_article><h2>Article Navigation</h2><p><txp:link_to_prev>Previous Article</txp:link_to_prev><txp:link_to_next>Next article</txp:link_to_next></p></txp:if_individual_article><txp:output_form form="syndication" /></div></div></div><txp:output_form form="foot" />- Download this code: /code/textpattern/pages/articles.txt
Bookmarks
This is the page template I use for my bookmarks section.
Update: I don’t have a bookmarks section any longer – I simply use del.icio.us
<txp:output_form form="dtd" /><txp:output_form form="head" /><txp:output_form form="content_head" /><div id="content"><div id="area1"><div class="content"><h1>Bookmarks</h1><p>A selection of sites, services and content I tend to visit frequently.</p><txp:linklist form="links" limit="300" sort="date desc" wraptag="ul" break="li" /></div></div><div id="area2"><div class="content"><txp:output_form form="search_form" /><txp:output_form form="filter_bookmarks" /><txp:output_form form="syndication" /></div></div></div><txp:output_form form="foot" />- Download this code: /code/textpattern/pages/bookmarks.txt
Default
This is the page template I use for my home page.
<txp:output_form form="dtd" /><txp:output_form form="head" /><txp:output_form form="content_head" /><div id="content"><div id="area1"><div class="content"><h1>Recent Articles</h1><txp:article_custom form="article_summary" limit="5" section="articles" sortby="Posted" sortdir="desc" listform="article_summary" /><p class="archives"><a href="/archives/" title="Browse all articles in the archives">Article archives</a></p></div></div><div id="area2"><div class="content"><txp:output_form form="search_form" /><txp:output_form form="site_overview" /><txp:output_form form="syndication" /></div></div></div><txp:output_form form="foot" />- Download this code: /code/textpattern/pages/default.txt
Search
This is the page template I use for my search results page.
Update: I don’t have a bookmarks section any longer – I simply use google
<txp:output_form form="dtd" /><txp:output_form form="head" /><txp:output_form form="content_head" /><div id="content"><div id="area1"><div class="content"><h1>Search Results</h1><dl><txp:article form="search_results" limit="20" listform="main_search_results" /></dl></div></div><div id="area2"><div class="content"><txp:output_form form="search_form" /><txp:output_form form="filter_categories" /><txp:output_form form="syndication" /></div></div></div><txp:output_form form="foot" />- Download this code: /code/textpattern/pages/search.txt
Wiring up the page templates
TextPattern associates Page Templates with sections of a site. In the Textpattern administrative screens (Presentation/Sections), I’ve created a section for each page template (named and titled the same as the page template) and associated each section with its page template by selecting it in the “Uses page” field.
I select default for the “Uses style” field for all sections, since I prefer to maintain my stylesheets manually.
There are other options provided for each section, as follows:
- Selected by default? I set yes to articles section, no to everything else.
- On front page? I set yes to articles section, no to everything else.
- Syndicate? I set yes to articles section, no to everything else.
- Include in site search? I set yes to about and articles sections, no to everything else.
Note: One thing that I really stumbled with understanding about the relationships between sections, page templates and articles in Textpattern is that although the front page renders against the section “default”, you cannot assign an article to the front page as you can to other sections. The front page does not have its own articles; it simply displays articles from all the sections that have the “display on front page” option set to “yes”.
About this page
This page contains a single post from Daniel Boerner's blog, of which Boot Camp + Windows Vista = no more Airport Extreme reboots is the latest post.
Are there more posts like this one?
Possibly. Within this blog, this post is categorized under danboenet and it was posted on June 6, 2005. Those would be good places to start looking for related posts.
This post is closed to new comments.