Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2024-07-17 16:25:33

sambooth74
Member
From: Leeds, England
Registered: 2020-11-24
Posts: 20
Website

Stanley: A very simple Textpattern theme

Introducing Stanley, a very simple Textpattern theme which wraps your content in clean, semantic HTML and minimal CSS.

It’s designed to work out-of-the-box, and also be a lightweight base for novice theme developers.

Link to demo site

Download version 1.0

What do you get?

  • Five top-level menus (you probably don’t want to keep all of them) enabling you to find content:
    • By section (by default this excludes the ‘pages’ section)
    • A list of articles from a specific section (by default this is the ‘pages’ section)
    • By category (supports nested parent/child categories)
    • By author
    • Using search
  • Support for all major Textpattern features including:
    • Comments
    • Pagination
    • Search
    • Article images
  • Two “fancy” features (these are isolated in the CSS so they can be removed easily)
    • “Hero” style formatting for article images.
    • The main navigation in the header uses a horizontal layout on wider screens.

Usage notes

  • You probably don’t need to keep all five top-level menus (and it’s a bit cramped if you do), so after installation, edit the ‘header’ form and remove the menus you don’t need.
    • Just delete the <li> tags you don’t need, or enclose them in <txp:hide> tags.
  • The theme assumes that your ‘static’ pages (those which are not date-time specific, for example a links or downloads page) are contained within a dedicated section called ‘pages’.
    • Articles in the ‘pages’ section are listed in their own menu in the header of each page.
    • The ‘pages’ section is excluded from the ‘Sections’ menu in the header of each page.
    • If your ‘pages’ section is called something other than ‘pages’ then you’ll need to edit the ‘header’ form and substitute your own section name.

Notes to other theme developers

I wish I’d known about the “contexts” you have to handle when building each page. This may still be wrong…

  • No section (default)
    • Category article list
    • Author article list
    • Search article list
  • Inside a section
    • Section article list
    • Article (single)

Last edited by sambooth74 (2024-07-17 16:39:32)

Offline

#2 2024-07-18 09:11:13

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

Re: Stanley: A very simple Textpattern theme

Nice! Always good to see new themes, and it serves well as a basis for those wanting to build on it. Your own site is a good advertisement for it in action, too!

Also admirably self-contained, and easy to read. Textpattern’s default template is well constructed but the google schema information complicates readability somewhat. Here you’ve left all that out, leaving a very readable result.

One thing I did notice: as far as I know, you can’t use meta and link rel="canonical" in the page body, only in the head block. You already have it in your head_meta form, so you can drop it from the body of the default page template altogether.

I’m assuming you mean the default template is only for use on the homepage: if you want it to be usable on other sections, it needs a txp:article for the regular section / individual_article output. txp:article can handle the article_list and individual_article cases on its own if you provide an article-type form called article_listing, or alternatively you specify a form of your own with the listform attribute.

I wish I’d known about the “contexts” you have to handle when building each page. This may still be wrong…

First of all, the way you’ve split the if_author, if_category and if_search conditionals into separate forms with their own txp:article forms works fine. You have some additional contextual headings, a sub-category menu, and custom “no articles found” message for each context, so splitting it out into forms for better page template readability makes sense.

But, as you’ve noticed, txp:article can already respond to each context – author, category, section, article_list, individual_article – automatically, so you could use your if_author, if_category conditional blocks just for the headings and pre-article information and then let txp:article respond to context on its own.
You have one complicating factor there: in your case, you have a different default attribute in your txp:article tag for each “no articles found”. You could set that message text as a variable (e.g. “no_articles_msg”) in advance in your if_category / if_author conditional block (e.g. under the heading) and then output the variable with default='<txp:variable name="no_articles_msg" />' … or – more easily – you could simply use a more generally worded message that works in all contexts.

If you want to make it more international, you can use <txp:text item="…" /> for a few more of your currently hard-coded headings. If you want to check possible values for item, you can search the /textpattern/lang/en.ini file for potential phrases, e.g. item="recent_posts" or item="recent_articles" for “Latest posts”, item="articles" for “Articles” etc. There isn’t always something for every situation, though.


TXP Builders – finely-crafted code, design and txp

Offline

#3 2024-07-18 09:23:19

dos
Member
From: de
Registered: 2014-05-17
Posts: 54
Website Mastodon

Re: Stanley: A very simple Textpattern theme

Nice. Sometimes that is all you need and it gives nice oldschool vibes. One glitch I’ve noticed on my iPhone: The comment form / text field is breaking the layout and scrolls horizontally.


“HaHa. Your medium is dying.” –Nelson Muntz, Springfield.

Offline

#4 2024-07-18 09:24:33

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: Stanley: A very simple Textpattern theme

jakob wrote #337410:

There isn’t always something for every situation, though.

O how great to see themes and their authors appear. This might be a fitting situation to point out the existence of custom textpacks methinks (caveat: wall of text blog post).

Offline

#5 2024-07-18 09:35:43

sambooth74
Member
From: Leeds, England
Registered: 2020-11-24
Posts: 20
Website

Re: Stanley: A very simple Textpattern theme

Jakob, thanks for taking the time to write such detailed feedback.

I’ll set aside some time over the next few weeks to continue improving the theme.

I’ve also developed a form which allows you to provide a file ID for a GPX file, and it will output an interactive map with the GPX information overlaid on it. Not sure whether I could package it as a plugin. Another area to explore.

Offline

#6 2024-07-18 10:31:26

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

Re: Stanley: A very simple Textpattern theme

wet wrote #337412:

O how great to see themes and their authors appear. This might be a fitting situation to point out the existence of custom textpacks methinks (caveat: wall of text blog post).

I know plugin textpacks, but can you supply custom textpacks (as a file?) for themes too? I’ve just done a multi-lingual site where I used smd_babel to define custom textpack strings and made a mini tag of my own to output the strings by language, essentially txp:text with a lang attribute.


TXP Builders – finely-crafted code, design and txp

Offline

#7 2024-07-18 14:04:20

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

Re: Stanley: A very simple Textpattern theme

jakob wrote #337414:

I know plugin textpacks, but can you supply custom textpacks (as a file?) for themes too?

You could, but it would have to go in the lang directory and you’d have to pretend it was a new language (give it a random but valid-sounding designator) so it didn’t blat any existing pack. Not advised.

Plugin textpacks are the preferred way of providing strings simply because if someone installs a new admin/site language and your plugin has strings for that language defined as part of its Textpack, they will be installed automatically.

Custom theme Textpacks aren’t really a thing yet, which is kind of annoying. You can of course bundle your own strings up in a pack file in your theme zip file. By using your theme name as the owner they remain encapsulated for easy removal or updating in future revisions of your theme. You could then use Textpack events to split your pack up to add certain things on certain panels or public ‘steps’ but it’s not as automated as plugins yet. The pack still needs installing by hand or via a bootstrap loader like we did with our theme.


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

Online

Board footer

Powered by FluxBB