Search code examples
titlebloggerblogspotstrip-tags

How to manipulate strings in a Blogger template. Impossible?


This question is about Blogger Template manipulation. People developing/changing or manipulating Blogger templates in any way know its syntax hence can provide some input.

I write a development blog on Blogger and I've changed my blog template so posts display HTML head title differently (post name first) from default (blog name first).

But. Since I format my inline programming code words similarly to Stackoverflow (gray background mono-spaced font) and do the same when I use any of them in blog post title... I enclose such code words inside <code/> element and then I have CSS set for this particular element to add it gray background and set mono-spaced font on it. This formatting works on blog post titles and its content.

But the problem I'm having is that these <code/> tags I use are also displayed in the HTML head title (displayed in browser window title). What is even more importan is that these get displayed in web search results as well. That's even more annoying.

Default template uses <data:blog.pageTitle/> in title element, which strips out any tags, but displays all titles as Blog Name: Blog post title (Google search results are quite meaningless because blog post title gets cut off). That's why I'm using <data:blog.pageName/> instead to display just blog post title in the head, but it still has all tags and I should strip them out somehow.

Check this blog post example. Load it, and look at browser's window title bar that still has tags displayed. I want them gone.

How do I strip tags from the post title when adding it to head element?


Solution

  • UPDATED

    ok, so far this is what i worked out:

    1. under settings -> Title -> put a nice &nbsp;
    2. use <data:blog.pageTitle/> as title;
    3. under design -> edit html -> replace theese lines

    <b:section class='header' id='header' maxwidgets='1' showaddelement='no'>
      <b:widget id='Header1' locked='true' title='  (Intestazione)' type='Header'/>
    </b:section>
    

    with your custom header like

    <div class="header section" id="header">
      <div class="widget Header" id="Header1">
        <div id="header-inner">
          <div class="titlewrapper">
            <h1 class="title">
              <a href="http://aseptik.blogspot.com/">aSeptik Site</a></h1>
          </div>
          <div class="descriptionwrapper">
            <p class="description">
              <span>
              </span>
            </p>
          </div>
        </div>
      </div>
    </div>
    

    <title> will result from:

    jQuery <em>"scroll into view"</em> plugin (with an additional <code>":scrollable"</code> selector filter)
    

    to

    : jQuery "scroll into view" plugin (with an additional ":scrollable" selector filter)
    

    hope this help, demo http://aseptik.blogspot.com/2011/02/jquery-scroll-into-view-plugin-with.html


    try with a little bit of javascript in your <body> like this

    <script type='text/javascript'>
    document.title = document.title.replace(/(&lt;([^&gt;]+)&gt;)/ig,&#39;&#39;);
    </script>
    
    </body>
    

    copy and past as is don't convert entities,

    although, i'm not sure this is the right solution for you since spiders usually avoid js execution, and i don't know how "html tags in the title" affects the search results.