Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-06-19 11:23:26

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 3,192
Website

Description field and tag

The current selection of tags and fields in Textpattern make it a massive headache to get one of the simplest site content requirements into the CMS, namely descriptions. Be that used for meta description, Twitter Card, Open Graph, Schema.org microformat, etc.

Yes there is an excerpt field, but since that is controlled by Textile at an article level toggle, it can’t be used for both short in-page content snippets and in head area descriptions (not without a plugin or some raw PHP anyway).

Yes here is also custom fields and plugins, but again that is counter-intuitive for such a basic requirement (and pretty unfeasible for packaged themes).

There needs to be a description field in the meta fields of the write page, along with a <txp:description />, <txp:if_description> tag set.

Ideally sections should also have a field for description too I think so that can be harnessed on non-individual article pages. Even categories could benefit from the additional field.

Offline

#2 2015-06-19 11:28:45

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: Description field and tag

The best would be arc_meta in the core.

Last edited by NicolasGraph (2015-06-19 11:28:58)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#3 2015-06-19 11:47:17

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,246
Website

Re: Description field and tag

I normally use the keywords field for that which could be renamed using wet babble.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

#4 2015-06-19 11:52:55

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 3,192
Website

Re: Description field and tag

colak wrote #291694:

I normally use the keywords field for that which could be renamed using wet babble.

I do too, but it strips certain characters out of the text so it’s not a great solution. This request is generally geared towards making themes easier to install without having to use hacks or having to provide an essay in the README on how to create custom fields.

Offline

#5 2015-06-19 12:09:47

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,632
Website

Re: Description field and tag

philwareham wrote #291692:

There needs to be a description field in the meta fields of the write page

OK, so as discussed elsewhere, this entails a new varchar in the textpattern table called description (is that a good term for it, or is it too vague for its intent to be understood?) which can hold the meta description for an article. Is 255 chars enough max storage? FYI, MySQL 5.0.3+ supports up to 65KB varchars.

The new field should go under the ‘Meta’ twisty, immediately above Keywords.

a <txp:description />, <txp:if_description> tag set.

Assuming the name description is acceptable and intuitive, presumably you want the former tag to output one of two things:

<meta name="description" content="field contents here" />

or, perhaps if an attribute is set, to output the raw field value so you can roll your own. Which should be the default? Raw or cooked? Bear in mind that every other ‘specific’ tag (i.e. pretty much all those except <txp:custom_field />) outputs cooked stuff unless told otherwise, so maybe we should continue the tradition. You will be able to use the <txp:custom_field name="description" /> trick to output the raw value too.

Any preference for attribute names to use?

Ideally sections should also have a field for description too I think so that can be harnessed on non-individual article pages. Even categories could benefit from the additional field.

I agree, and easy to add. The same tag as above could be used with an attribute to choose which type to display (article, category, section). Maybe it could be context dependent to auto-switch if possible, not sure.


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

Offline

#6 2015-06-19 12:17:30

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,400

Re: Description field and tag

Bloke wrote #291696:

The new field should go under the ‘Meta’ twisty, immediately above Keywords.

Normally I use for this a glz_custom_field as textarea, so the field is situated in the middle column with more space for the text. I don’t like the left column for this type of things.

Offline

#7 2015-06-19 12:20:52

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 3,192
Website

Re: Description field and tag

Looking at previous tag syntaxes used, maybe we also add a <txp:meta_description /> tag that outputs:

<meta name="description" content="field contents here" />

In addition to a <txp:description /> tag that just outputs the raw field value and can be used for all manner of things (see original post).

Then they don’t really need any extra attributes I guess.

How’s that?

Offline

#8 2015-06-19 12:20:52

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,197

Re: Description field and tag

Bloke wrote #291696:

Raw or cooked?

Cooked, so that apostrophes can’t do any harm.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#9 2015-06-19 12:24:23

philwareham
Core designer
From: Farnham, Surrey, UK
Registered: 2009-06-11
Posts: 3,192
Website

Re: Description field and tag

Bloke wrote #291696:

Is 255 chars enough max storage? FYI, MySQL 5.0.3+ supports up to 65KB varchars.

The current optimal description length for Google is around 115-120 characters – so it’s up to you. With that in mind, I am OK with it being in the meta twisty. Anyway, our plans are to eventually let users move bits of the UI around, so for now that is OK place to put it.

Offline

#10 2015-06-19 12:28:50

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,246
Website

Re: Description field and tag

Hi Phil, I see what you are looking for.

Stef, I think that the new field should be similar to the keywords field so the new tag should -in my view – be used like

<meta name="description" content="<txp:description" />

In this way, the field could be used for something else should someone wants to. Re the varchar, does anyone remember what is the max number of characters Google is allowing for descriptions? One cool way is to have the field have 65k but limit its characters in the preferences. Is this possible?


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

Board footer

Powered by FluxBB