Jump to content

Hanna Code For Good Branding And Seo

Recommended Posts

Ryan's Hanna Code module is a seriously useful bit of kit, not just for blog type systems where you want to insert a gallery or something clever, but for business websites where consistent branding and messaging is paramount.

Lack of consistency can do a surprising amount of damage to a brand - if the way you refer to a company is inconsistent or unusual, for instance, you can confuse the visitor or split your messaging.

Likewise, important messaging statements (keyword phrases in SEO), need to be kept consistent and current.

It is all a bit obvious really, but it is amazing how easy it is to get wrong. And if phrases or contact info or even the company name changes, then trying to update the site with hundreds, perhaps thousands of pages could be a nightmare.

Using the Hanna Code Module creatively, but very simply, can save you a lot of heartache and keep things on track. This is probably the simplest use of the module since all you doing is using it as a text replacement rather than for entering complex code.

If you have created some sort of central settings page in your page tree that is for global values like Site Name, or main background image or whatever, consider adding a bunch of simple text fields for things like:

  • Company Phone Number
  • Company Name
  • Company email address
  • CEO's name
  • Small company logo (that would be a single image field, of course)
  • Company slogan

Then, using the Hanna Code Module, set up hanna codes to retrieve this information.

For instance, create a hanna code called "company"

Set it for php, save and then under code, add the following:


echo $pages->get("/settings/")->company_name;

Here I have assumed you have a hidden page as a child of your home page called "settings" and that the field for you company name is called company_name.

Now, add the Hanna Code text formatter to every field that you may need to use it in.

Within those fields, [[company]] will now be replaced with the company name. If the way the company name is written changes at any point, then it will be changed in all text.

While you are about it, you can retrieve the same field without the hanna code module directly into templates where required. Now the company name throughout the entire site is consistent and is controlled by one simple field on a settings page. All you need do is take a very large rock to any authors who do not use it!

Branding is important, more important than pretty pictures, clever JQuery, responsiveness and even SEO. Giving the client controls so that their carefully worked out brand values are not just used, but used consistently and without errors throughout their site, should be all part of the service, and Hanna Codes give you that.

And for small clients who have not quite got their heads round the idea of building a brand, it may help them think about it more carefully.

  • Like 11

Share this post

Link to post
Share on other sites

Very good points, Joss. One of the arms of the company I work for sells advertising, in just 3 standard sizes, each size having a price, and I did the same as you mention above with those sizes & prices, so each mention across the site can be updated in one place.

Bonus Suggestion - (along similar lines) One thing I have been doing recently is, in /site/config.php, declare $config->siteName = 'Your Site Name Here'; and then I can use that variable anywhere in the site (navbar brand, meta title etc.etc.). Save typing and ensures consistency. (And makes standard boilerplate site profiles easier.)

  • Like 3

Share this post

Link to post
Share on other sites

The other useful think you can use it for (though a bit more dangerous from the layout point of view) is have a contact panel. So everytime they type [[contactus]] it creates a panel or popup or something with all contact details, contact form, chat link, or whatever.

I must admit I haven't used config.php for that sort of thing, mostly because the client does not have access to it - that can cut both ways, of course

Share this post

Link to post
Share on other sites

 A very good and much needed tutorial.  There are so many different and great uses for the technology that has been created within the ProcessWire community.

Share this post

Link to post
Share on other sites

This is a great conzept of using Hanna Code with Pages...another thing that would work the same way...

A Kind of Glossary:


/glossar/ (or name it tags)

--phrase one (Title, Url, Description for tooltip or something else, maybe some pagefield for cathegories)

--phrase two

--phrase three

didn't tested but should work.

For acronyms, tooltips and simple Contenttags just to use in every contentblock/article/topic that it is needed!!

Thats a whole taggingsystem with just one snippet ;)

Thanks for sharing this basic idea!

Share this post

Link to post
Share on other sites

In our company site i'm using Hanna code all over the place for company phone and fax numbers and e-mail addresses. Its very easy to manage when a value needs to be changed. Change it once in the hanna code and ~voila~ its changed site wide :)

Some examples usages in our site: (translated to english for these examples)

[[phone nr="marketing"]]
[[fax nr="sales"]]
[[email address="subscriptions"]]
  • Like 7

Share this post

Link to post
Share on other sites

Just pinning this CKEditor Addon here that fits for some of the mentioned usecases:



you could define your own list of strings for insert in CKE - so you could setup the predefined HannaCodes for the customer to just only select the right one....

regards mr-fan

  • Like 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Mike Rockett
      Docs & Download: rockettpw/markup-sitemap
      Modules Directory: MarkupSitemap
      Composer: rockett/sitemap
      MarkupSitemap is essentially an upgrade to MarkupSitemapXML by Pete. It adds multi-language support using the built-in LanguageSupportPageNames. Where multi-language pages are available, they are added to the sitemap by means of an alternate link in that page's <url>. Support for listing images in the sitemap on a page-by-page basis and using a sitemap stylesheet are also added.
      Example when using the built-in multi-language profile:
      <url> <loc>http://domain.local/about/</loc> <lastmod>2017-08-27T16:16:32+02:00</lastmod> <xhtml:link rel="alternate" hreflang="en" href="http://domain.local/en/about/"/> <xhtml:link rel="alternate" hreflang="de" href="http://domain.local/de/uber/"/> <xhtml:link rel="alternate" hreflang="fi" href="http://domain.local/fi/tietoja/"/> </url> It also uses a locally maintained fork of a sitemap package by Matthew Davies that assists in automating the process.
      The doesn't use the same sitemap_ignore field available in MarkupSitemapXML. Rather, it renders sitemap options fields in a Page's Settings tab. One of the fields is for excluding a Page from the sitemap, and another is for excluding its children. You can assign which templates get these config fields in the module's configuration (much like you would with MarkupSEO).
      Note that the two exclusion options are mutually exclusive at this point as there may be cases where you don't want to show a parent page, but only its children. Whilst unorthodox, I'm leaving the flexibility there. (The home page cannot be excluded from the sitemap, so the applicable exclusion fields won't be available there.)
      As of December 2017, you can also exclude templates from sitemap access altogether, whilst retaining their settings if previously configured.
      Sitemap also allows you to include images for each page at the template level, and you can disable image output at the page level.
      The module allows you to set the priority on a per-page basis (it's optional and will not be included if not set).
      Lastly, a stylesheet option has also been added. You can use the default one (enabled by default), or set your own.
      Note that if the module is uninstalled, any saved data on a per-page basis is removed. The same thing happens for a specific page when it is deleted after having been trashed.
    • By franciccio-ITALIANO
      Hi, we can choose the "headline" and "title" and "summery" in panel page of processwire, but we can't write the "metadecriptions" and "tags".
       I can write mdescropt and tags in templates, but I've same templates for many articles... so, how I can change mdescription and tags?

    • By Leftfield
      Hi All 🙂

      How to append canonical URL to head from certain templates?

    • By louisstephens
      I have a repeater with a text field where I would like to use hanna code (to make it easier on the user) so the user can define the action of a image that is in the repeater. For example:
      1. The image should have an external link:
      - the user can just type in the url
      2. The image, when clicked, should be printable (using print.js)
      - the user can just type [[print_image]]
      That works just fine, but I am running into an "issue". The code I need to use to print is:
      onclick="printJS({printable: 'path_to_image', type: 'image'});" I can put that into the hanna code as plain text, but I have no idea how to get the image from the repeater item and pass to "path_to_image". Is this even possible?
    • By Marco Angeli
      Hi there,
      I added a ssl certificate to my site and I'd like to redirect every single http url to its new https version
      So I added this code in the .htacces file, after the RewriteEngine On :
      Redirect 301 /about https://www.mysite.it/about
      Unfortunately this is now working: I get the "too many redirects" error.
      The following code works, but it's a bulk redirection to the home page, something I don't want for SEO reasons (https://moz.com/blog/save-your-website-with-redirects😞
      RewriteCond %{HTTP_HOST} mysite\.it [NC]
      RewriteCond %{SERVER_PORT} 80
      RewriteRule ^(.*)$ https://www.mysite.it/$1 [R,L]
      Any suggestions?
  • Create New...