Whenever you create a site section that houses your articles, at minimum you assign to it:

  • A page: markup (typically HTML) scaffold with Textpattern tags to your requirements.
  • A style: presentational stylesheet rules that govern how the content appears.

Page scaffold and stylesheet combinations can be applied to one or more sections, and the multi-edit tool permits rapid batch changes. Further, you can choose to assign pages and styles to your live site and/or a development staging area that only you and your client can access.

From Textpattern 4.8, there’s a new page type: empty.

What’s the purpose of a live section that has no page template? Would that mean any content assigned to that section is inaccessible or invisible to visitors and search engines?

Yes! And that’s exactly the point. This page type is for content that’s always there, but behind the scenes.

Before we find out how this feature can be useful, here’s a brief rundown on why it’s necessary.

Content separation goals

With Textpattern, we consciously aim to keep content (i.e. writing/images/files/etc) and presentation (i.e. layout) separate. A long-running website problem has been that designers set up a site and sometimes want “static” content that appears all on one page – usually a section landing page – but need the flexibility of articles to store custom field information.

Let’s take an example: a meet-the-team section where you list the key players in your organization and give brief background information on them, along with a flattering portrait image. A few methods for handling such content might be:

  • Write a single article called team-members in that section and list everybody in it. State their profile info, their position, include their portrait image inline, and so forth. Problems:
    • It could rapidly become an unwieldy article, especially with large and/or complex teams.
    • Making changes would mean hunting through the article, and incorrect changes might affect other profiles.
    • You might get duplicate content at /meet-the-team/ and /meet-the-team/team-members/.
  • Write the profile content directly in the page template, or in one or more forms (i.e. code snippets that can be used over and over) and include everything on the landing page. Problems:
    • That breaks the content/layout separation.
    • Some Content Editor roles don’t have access to the Presentation area, so this content cannot be easily altered by them: Designers need to be involved.
  • Write each individual profile as an article and list them on the section landing page. Problems:
    • You need additional page logic to handle individual articles.
    • You need to prevent them from being linked by omitting the permlink and/or using canonical links.
    • You need to hope that search engines and visitors don’t access the URLs individually.

It’s a mess. None of the options seem to quite fit the task at hand.

Consider pageless sections and how they can help solve this conundrum.

Pageless sections to the rescue

Steps to success:

  1. Create your meet-the-team section as normal.
  2. Create a second section called team-members and assign it an empty page, so nothing in this section is discoverable via a URL. The permlink scheme won’t apply, and nor will the stylesheet.
  3. Create individual profile articles for each employee in the team-members section.
  4. Set your meet-the-team article to either a) use an override form, or b) include the following tag:
<txp:article_custom section="team-members" form="bio" limit="99" />

It’s a subtle change, but there are multiple benefits:

  • Each member profile is its own article. The content can be updated by users with article editing privileges. Each article has the full suite of categories, custom fields and article metadata available to it, allowing further fine-tuning of each profile.
  • Changes to individual team members are atomic. If Alice changes role, alter their assigned article. If Bob leaves the company, set their article to hidden (or delete it).
  • The individual profile pages are not indexable by search engines and unreachable by URL guessing. Anything in the team-members section has an empty template, so cannot be viewed directly and will present a 404 Not Found error.
  • No duplicate ‘static’ content. Even if you place the entire contents of all articles on the landing page, no individual reachable URLs mean the landing page is the only place it appears on your site.
  • You retain control over how each bio looks on the landing page via the bio form. If you want to reformat or omit a piece of metadata, do it once in the form and they all change instantly.

Get creative with pageless content

A team profile page is one example. You can create all kinds of interesting uses for pageless content: perhaps data sheets or tables you want to be associated with one or more main articles, or multi-lingual content for your long-form blog exploration, or simple product variants for an e-commerce shop.

In these cases, you can associate a visible article to hidden content in a pageless section using a custom field that lists article IDs. This functionality has been possible in Textpattern for some time, but the applications are more flexible now that content can be more easily hidden and collected together in a section, away from direct public and/or web crawler access.

A note on setting pageless sections via multi-edit

One important distinction needs to be made: pageless sections can only exist in a live site workflow context. They don’t make sense in a development/staging workflow: since there’s no page, there’s no dev/live workflow to split.

For this reason, if you try to assign an empty page or style to the development workflow, nothing will happen. You need to set the Live checkbox to make it take effect, or edit the section directly by clicking its name in the list.

As long as you remember this key point, you can dream up ways in which pageless content can better serve not only your site visitors but your content editors too.

We hope this new feature addition to the Textpattern toolkit will expand the possibilities for your next web project even further. Let us know your best Textpattern pageless section recipes in the Textpattern support forum!