Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2019-05-05 20:48:27

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

Category/section description in a category/section/article list?

Is there a way to output the description field of a category or section as part of a category_list / section_list tag, or in a if_different of an article list?

I tried meta_description tag without success (presumably it needs the category context). In the if_different section of an article list, I came up with this, but can’t help wondering if there’s a better way:

<txp:php>
    global $thisarticle;
    $desc = safe_field("description", 'txp_category', "name = '".doSlash($thisarticle['category1'])."' AND type = 'article'");
    if ($desc) echo '<p>' . $desc . '</p>';
</txp:php>

TXP Builders – finely-crafted code, design and txp

Offline

#2 2019-05-06 04:56:34

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: Category/section description in a category/section/article list?

I take it that this did not work?

<txp:section_list wraptag="ul" break="">
    <li<txp:if_section name='<txp:section />'> class="active"</txp:if_section>>
        <txp:section title="1" link="1" />
            <ul>
                <li>
                    <txp:meta_description format="" />
                </li>
            </ul>
    </li>
</txp:section_list>

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2019-05-06 08:27:38

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

Re: Category/section description in a category/section/article list?

Thanks Yiannis. I should check that to be sure. My situation was an article list with top:if_different and it definitely didn’t work there.


TXP Builders – finely-crafted code, design and txp

Offline

#4 2019-05-06 14:24:58

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: Category/section description in a category/section/article list?

Or if you can post the code you are using, somebody might able to assist.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2019-05-06 17:09:12

etc
Developer
Registered: 2010-11-11
Posts: 5,028
Website GitHub

Re: Category/section description in a category/section/article list?

jakob wrote #317893:

Is there a way to output the description field of a category or section as part of a category_list / section_list tag, or in a if_different of an article list?

Inside category_list or section_list this should work:

<txp:meta_description type="category" format="" />

Offline

#6 2019-05-16 14:20:41

singaz
Member
Registered: 2017-03-12
Posts: 150

Re: Category/section description in a category/section/article list?

It would be nice to have a separate description field to fill in categories and sections.

And it would be nice to have a separate field to fill the title (meta_title).

Now the title is double h1. No choice. It is not good.

Now there is no normal description for the section and category.

This is very important for SEO. Correctly filling in these fields may affect search results.

There is only 1 arc_meta plugin, and this author came out, now it works poorly, there are concerns that in the new version txp will stop working.

A very good textpattern engine is not friendly for a SEO.


Sorry my horror English. I’m learning textpattern, I’m learning English

Offline

#7 2019-05-16 15:10:04

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

Re: Category/section description in a category/section/article list?

Well, there is now a description field for sections and categories that you can access in category or section context or in a category_list and section_list as etc mentioned for use with the meta description tag.

If you want to have different title and h1 titles in an article, you can define a custom field to hold that text. I do that occasionally but more usually when I want a shorter menu_title for the navigation. With bot_wtc, you can also shift the custom field to where you want it to appear on the write tab.

If you want another field in the section and category panes, I think I have two unpublished plugins for adding custom fields to sections and categories.

However, the plan, as far as I know, is that it will be possible in a future txp version to add custom fields to other panes. The feature is already in development on a separate branch on GitHub.

There are also other plugins like rah_meta(s) that allow you to populate the meta tags with parts of your page content.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB