Textpattern CMS support forum

You are not logged in. Register | Login | Help

#21 2015-06-22 09:48:03

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

Re: Description field and tag

phiw13 wrote #291770:

how to migrate a truckload of articles to make use of this…

Yes, that’ll probably require flexing some SQL muscles to copy your excerpts in to the description for certain articles, taking into account:

  • No Textile support in the new field.
  • The 255 char limit.
  • You’ll need to empty out both excerpt and exceprt_html fields from each article upon successful migration of a description.

And then update your templates to use the new tags. Not exactly a walk in the park unfortunately.


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

#22 2015-06-22 09:56:32

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

Re: Description field and tag

Bloke wrote #291772:

For anyone following this thread, descriptions for articles, sections and categories have landed in core. Two new tags support them…

Isn’t it 3 new tags?

  • <txp:description />
  • <txp:if_description />
  • <txp:meta_description />

Offline

#23 2015-06-22 10:09:13

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

Re: Description field and tag

philwareham wrote #291775:

Isn’t it 3 new tags?

Nope. I consolidated what was to become <txp:description /> into <txp:meta_description> to fit in with the other <txp:meta_* /> tags, and just allowed the raw value to be output via an attribute. So that tag fulfils both roles. It’s all meta data, regardless of how you (ab)use it in your Pages.

Kinda wanted to go with <txp:if_meta_description> for consistency with the main tag, but we already have <txp:if_keywords> so I dropped the meta bit to fit in with the conditional lineage.


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

#24 2015-06-22 10:14:34

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

Re: Description field and tag

Bloke wrote #291778:

Nope. I consolidated what was to become <txp:description /> into <txp:meta_description> to fit in with the other <txp:meta_* /> tags, and just allowed the raw value to be output via an attribute. So that tag fulfils both roles. It’s all meta data, regardless of how you (ab)use it in your Pages.

Kinda wanted to go with <txp:if_meta_description> for consistency with the main tag, but we already have <txp:if_keywords> so I dropped the meta bit to fit in with the conditional lineage.

Yeah but there is already a <txp:keywords /> tag hence the <txp:if_keywords>. Sorry I know you want to minimise additional tags I would really prefer there to be a <txp:description /> tag too (and remove the current attribute from meta_description) – what’s everyone else’s thoughts on this?

Offline

#25 2015-06-22 10:45:45

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

Re: Description field and tag

philwareham wrote #291779:

Yeah but there is already a <txp:keywords /> tag hence the <txp:if_keywords>.

OK, yeah, I s’pose. So the conditional tag kinda serves to allow you to differentiate both tags. And the two tags do exactly the same thing, except one outputs formatted content, the other outputs raw.

We can play it either way. Or take the curveball and deprecate <txp:keywords> in favour of adding a format attribute to <txp:meta_keywords>. The existing <txp:keywords> tag in use in people’s templates would then just throw a warning in testing mode (but would still work), acting as a stub for <txp:meta_keywords format="raw" />.

EDIT: Or vice versa: keep <txp:keywords> and <txp:description> with format attributes and remove the <txp:meta_*> variants (though what to do with <txp:meta_author>… deprecate that too and add a format attribute to the <txp:author> tag?)

Don’t mind either way. Whatever the community prefers.

Last edited by Bloke (2015-06-22 10:48:02)


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

#26 2015-06-22 10:50:10

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

Re: Description field and tag

Bloke wrote #291783:

We can play it either way. Or take the curveball and deprecate <txp:keywords> in favour of adding a format attribute to <txp:meta_keywords>. The existing <txp:keywords> tag in use in people’s templates would then just throw a warning in testing mode (but would still work), acting as a stub for <txp:meta_keywords format="raw" />.

Sure, that could work too. I guess keywords are ‘meta’…

“Meta is a prefix used in English to indicate a concept which is an abstraction from another concept, used to complete or add to the latter.” – Wikipedia

Offline

#27 2015-06-22 14:04:30

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

Re: Description field and tag

I’m tempted to rethink this meta lark a bit. 4.6.x introduces <txp:author url="1" /> for displaying the author as a raw link instead of a name. What about if we tried to standardise things a tad:

  • <txp:author format="url" /> (instead of <txp:author url="1" />). It’s more readable if nothing else.
  • <txp:author format="meta" /> (same as <txp:meta_author />, except it won’t return empty if there’s no author at present).
  • <txp:author format="link" /> (instead of <txp:author link="1" />, outputs a linked author name).
  • add escape="html" attribute so you have the option to output the author raw.

That would have a knock-on effect for standardisation that we would:

  • have <txp:description format="meta" /> (instead of the proposed format="tag" attribute).
  • ditch <txp:meta_description />, or use it as a shortcut to the above.

And:

  • have <txp:keywords format="meta" /> (same as <txp:meta_keywords> without the check to see if it’s empty. Alternatively, deprecate the meta-specific tag).
  • add escape="html" to the <txp:keywords/> tag for output flexibility.

Using format="link" fits in with the <txp:css>, <txp:feed_link> and <link_feed_link> tags. But it does mean that we might consider the same attribute in place of link="1" in <txp:thumbnail>, <txp:link_author>, <txp:link_category>, <txp:comment_name>, <txp:author_email>, <txp:category>, <txp:category1>, <txp:category2>, <txp:section>, <txp:image_author>, <txp:file_download_author>, and <txp:breadcrumb>. It also scuppers <txp:image_url> slightly as that has an link="auto" option. And does it clash with the ‘date-based’ usage of format in the posted, modified, expires tags? (although we have those already alongside other format attributes).

So maybe it’s not such a good idea, but I dunno. I’m not talking about removing the attributes, just deprecating them and moving towards fewer, more standardised attributes. Is that a long-term goal?


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

#28 2015-06-22 14:22:40

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

Re: Description field and tag

I don’t know – that sounds more complicated to me. I’d be OK with deprecating <txp:keywords> and having the format="raw" on the <txp:meta_keywords> and <txp:meta_description> as suggested previously. The keywords and description appear in the meta section of the Write page after all, so the tags are quite self-explanatory.

Offline

#29 2015-06-22 14:42:14

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

Re: Description field and tag

philwareham wrote #291812:

format="raw" on the <txp:meta_keywords> and <txp:meta_description> as suggested previously.

Yeah, that’s the inverse of the above. And equally valid, it’s just that if we’re considering deprecating <txp:keywords>, and using <txp:meta_description> instead of <txp:description>, where does that leave <txp:author>? It’s sort of a special case in a way, that just happens to have a companion <txp:meta_author> for specific meta-usage. But that’s why I considered keeping the ‘non-meta’ versions with an attribute, versus keeping the meta versions, ditching keywords and also having an author tag.

I’m equally fine with keeping both the ‘meta’ and ‘non-meta’ versions of all three tags, so having six tags in three pairs. Maybe adding format="meta" to each of the non-meta variants too. That would then mean more than one way to produce a desired result, which could be regarded as a boon or a potential source of confusion / bloat.

Not sure. Changing the tag handlers to be more consistent isn’t hard, it’s just whether we want to consider it. I don’t want to introduce a format="tag" attribute for the sake of it when it’s the only tag using it, but then <txp:meta_description format="meta" /> seems over-wordy and largely redundant. I like format="raw" or format="" though, if we keep the <txp:meta_*> tags.

Hmmmmmmmm.


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

#30 2015-06-22 14:56:07

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

Re: Description field and tag

Actually format="" is pretty good idea, it’s got previous history on other tags’ syntax.

I’m still leaning towards deprecating <txp:keywords> tag.

<txp:author> has other uses outside of meta stuff, so I don’t see that as an inconsistency.

Offline

Board footer

Powered by FluxBB