[pmwiki-users] more SEO-friendly heading markup rule

Bronwyn Boltwood arndis at gmail.com
Fri Nov 11 11:56:48 CST 2005


Today I needed a more SEO-friendly heading markup rule for a skin that
uses h1 for the page title, and took a crack at making it myself.  If
it's useful for others, we can put it in the cookbook.

Here's what I wanted:

!heading (1 bang) --> <h2>heading</h2>
!!heading (2 bangs) --> <h3>heading</h3>
!!!heading (3 bangs) --> <h4>heading</h4>
!!!!heading (4 bangs) --> <h5>heading</h5>
!!!!!heading (5 bangs) --> <h6>heading</h6>

<h1> is used for the page title and I don't want it used elsewhere,
but I also don't want to force authors to use !! for headings, if only
because I'll forget.

So I took the original markup rule, and produced this:

Markup('^!', 'block',
  '/^(!{1,5})\\s?(.*)$/e',
  "'<:block,1><h'.(strlen('$1')+1).PSS('>$2</h').(strlen('$1')+1).'>'");

which to my surprise, works.

Bronwyn




More information about the pmwiki-users mailing list