Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#37 2015-06-23 10:12:31

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,538
Website GitHub Twitter

Re: Description field and tag

Thanks Stef for clarification.

Offline

#38 2015-06-23 12:28:04

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

Re: Description field and tag

philwareham wrote #291859:

If you spot any errors or improvements for those docs, then raise an issue or mention here.

Assuming I understand the function of these tags so far, and that I understood your doc, then they could be cleared up a bit, for example…

——

<txp:meta_keywords />

The meta_keywords tag is a single tag used in one of two ways, or both. One is to output keyword data as the content of a standard HTML meta tag in the head of a page template:

<meta name=“keywords” content=“{your keywords}” />

The other is to output raw keyword text anywhere else:

{your keywords}

Context of use must be with a single article (as opposed to an article list). The tag can be added directly in a [[Page template]] or as part of an article [[Form template]]. Either way, you may also nest it in a given article tag.

Note: The corronsponding keywords field has a 255 character limit by default, which includes spaces and commas. This is the MySQL database default. You can edit the default using phpMyAdmin, for example.

Offline

#39 2015-06-23 12:45:22

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

Re: Description field and tag

Destry wrote #291870:

they could be cleared up a bit

Much obliged. I’ll clean up the meta description tag in a similar manner for clarity next.

EDIT: no I won’t, Phil’s done it!


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

#40 2015-06-23 13:04:48

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Description field and tag

Sorry, we were both editing the same file for a minute there! Done now.

Offline

#41 2015-06-23 15:37:56

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

Re: Description field and tag

philwareham wrote #291859:

If you spot any errors or improvements for those docs, then raise an issue or mention here.

What does “raise an issue” entail? I.e., if I wanted to offer help on doc pages (as I happen to see things in the course of life) besides posting notes in the forum (which won’t go far) what is the process?

N.B. I rarely look at Github. Every time I learn to use it in some small way, months go by and I forget what I learned. Is there a quick-up-to-speed guide somewhere in this case? I’m happy to relearn again. Just point me in the right direction.

Offline

#42 2015-06-23 16:08:02

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Description field and tag

Destry wrote #291889:

What does “raise an issue” entail?

All our GitHub projects have the issue features turn on. So for instance if you want to raise an issue on the documentation, go here then click the ‘New issue’ button.

Offline

#43 2016-05-28 23:05:06

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

Re: Description field and tag

Is it possible to retrieve a particular description field, for example from the default section when not in that section?

The thinking behind this is to specify a default/fallback value if no description is specified.

I tried with:

<txp:section_list sections="default"><txp:meta_description /></txp:section_list>

but had no luck. Putting <txp:section /> in the container returns the correct section but txp:meta_description doesn’t work in the same way. Any other ideas?


TXP Builders – finely-crafted code, design and txp

Offline

#44 2016-05-29 01:21:06

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,210
Website

Re: Description field and tag

If I understand correctly: you want something similar to what already exists (docs) for categories: txp:meta_description value="category.image">.

Thus extending the existing txp:meta_description value="section"> to txp:meta_description value="section.default">

Yeah, that would be useful to output a description meta if no description exist for a given context. For now, in my <txp:if_description><txp:else />….. block I (manually) add a @<meta name=“description” content=“foo”> as a last resort.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#45 2016-05-29 07:17:40

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

Re: Description field and tag

phiw13 wrote #299351:

If I understand correctly: you want something similar to what already exists (docs) for categories: txp:meta_description value="category.image">.

Yes, kind of. Except that my understanding of the value="…" method is that it is an additional specifier within the prevailing context (i.e. “which aspect of the current page context am I specifically interested in?”). Being able to retrieve the value for another section would be stepping out of the existing context, kind of like how txp:article_custom works with respect to txp:article.

Yeah, that would be useful to output a description meta if no description exist for a given context. For now, in my <txp:if_description><txp:else />….. block I (manually) add a @<meta name=“description” content=“foo”> as a last resort.

Yes, exactly. Now that we have the fields for sections and categories – which I think is excellent – I can ditch all those extra adi_variables/cnk_snippets fields for each section that I used to use. And it is better that the fields live with the respective item they belong to. Except, that is, for the default case where I still need an adi_variable if the default meta description is to be user-editable.

An aside: What do you think is better from an SEO perspective?

  • Specifying a default meta description. This gives you potentially better term correspondence across parts of the page (depends a bit on the variance of topics in a site, of course) but you also end up with duplicate meta description values across pages when the user doesn’t specify a description, which could lead to exclusion of similar pages from search results.
  • Using no description. You forfeit any extra term repetition gain but google will do its best on the search results page to provide an extract for that page.

TXP Builders – finely-crafted code, design and txp

Offline

#46 2016-05-29 21:23:26

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

Re: Description field and tag

jakob wrote #299350:

Is it possible to retrieve a particular description field, for example from the default section when not in that section?

Yes, unless I’m missing something. You may need to use the type attribute to force the context, otherwise it picks up whatever context it thinks is best. For example, if you were on an individual article Page and you wanted the Section description to be checked, you’re out of luck unless you tell Txp that’s what you want.

As far as I can tell, your snippet works, but here’s an extended example from a regular Page template (that’s not set as the default Section):

<txp:if_description type="section">
   Got Description for <txp:section/>: <txp:meta_description type="section" format="raw" />
<txp:else />
   <txp:section_list sections="default">
      Using fallback: <txp:meta_description format="raw" />
   </txp:section_list>
</txp:if_description>

[ using format="raw" just so we can see the output on the page without viewing source ]

So that will display the default Section’s description if the current Section does not have a description. If you omit the type attribute from the conditional, it’ll output the default Section’s description if:

  • there’s no article description and you’re in an individual article context
  • there’s no section description and you’re in an article list context

Am I missing some esoteric use case here to provide a sensible fallback?

btw, the if_description docs are wrong and don’t mention the type attribute. Plus there’s a cateogry typo. Note to self: fix sometime.


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

#47 2016-05-30 07:27:59

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

Re: Description field and tag

Bloke wrote #299363:

As far as I can tell, your snippet works…

<txp:section_list sections="default">
      Using fallback: <txp:meta_description format="raw" />
   </txp:section_list>

My bad … you’re absolutely right: it does work (also without the wrapper). I have no idea what I did wrong the first time but it does work as you describe.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB