Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#121 2016-09-14 14:11:24

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: rah_metas // new 1.x-versions of SEO/redirecting/automatic meta-tools

Does anyone know what hacks are needed to make rah_metas work with Txp 4.6.0? I already added it to the tag registry, but I see a lot of “undefined variable” errors in Debug mode, including “expired”, “id”, “time”, and “keywords”.

Offline

#122 2016-09-14 14:18:13

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

Re: rah_metas // new 1.x-versions of SEO/redirecting/automatic meta-tools

johnstephens wrote #301461:

Does anyone know what hacks are needed to make rah_metas work with Txp 4.6.0?

Is it needed any more, given we’ve added meta_description to articles, sections and categories in 4.6.0? I’m not familiar enough with this plugin to know if it adds anything else to the mix that the core can’t offer.

Edit: Of course, you’d have to first migrate your data from whichever fields the plugin stores your meta data in, using some SQL hackery.

Last edited by Bloke (2016-09-14 14:19:49)


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

#123 2016-09-14 14:52:53

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: rah_metas // new 1.x-versions of SEO/redirecting/automatic meta-tools

Thank you, Stef!

I imagine it’s not too hard to do all of what this plugin does with native tags, including a bunch of conditionals.

Here’s what I get from one instance of rah_metas:

<meta name="keywords" content="{all the keywords, up to the designated limit}" />
<meta name="description" content="{truncated description from designated fields}" />
<link rel="prev" href="{/link/to/previous}" title="Previous" />
<link rel="next" href="{/link/to/next}" title="Next" />

If there are no keywords, that tag is omitted. Likewise with previous and next links. I can designate a number of fields from which to generate a description, and rah_metas uses the first non-empty field. If the input is long, it automatically does the work of rvm_substr and strips HTML to make it potable.

I’m sure I can do all of this with Textpattern core—and I suppose I might have to—it’s purely a matter of convenience.

Here’s the tag that generated it all:

<txp:rah_metas
  description_from="description, excerpt, body"
  keywords_limit="10"
  messy_to_clean_redirect="1"
  relnext="Next"
  relprev="Previous"/>

Last edited by johnstephens (2016-09-14 14:53:23)

Offline

#124 2016-09-14 15:15:59

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

Re: rah_metas // new 1.x-versions of SEO/redirecting/automatic meta-tools

johnstephens wrote #301466:

I imagine it’s not too hard to do all of what this plugin does with native tags, including a bunch of conditionals.

Based on your description, the plugin does quite a bit more than core tags so you might not be saving much if you migrated. Let’s see:

  • The core’s description is context-sensitive so you don’t (necessarily) need to designate the fallback locations. Though if you wanted to do so, the logic would be more complex and you’d need rvm_substr if you were pulling from Exceprt or Body. You also get descriptions on category landing pages for free.
  • The keywords will automatically be omitted when you use the core tag if there aren’t any keywords in the article. As you surmise, you do need a conditional to protect yourself if not in individual article context. And I’m not sure what rah_metas outputs for keywords on landing pages.
  • The rel tags can be hard-coded with link_to_next/prev tags but, again, you need conditionals in case you’re at either end of the chain. rah_metas shields you from this complexity.

You could wrap all this functionality up into a Form and call it from your Page template, so at least you only need to code it once. But you’d need to decide if it’s worth the pain of wrapping conditionals, extra plugins and handling edge cases vs. modding this plugin to fix the warnings which are, after all, just warnings.


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

Board footer

Powered by FluxBB