Forum Discussion

iftomkins's avatar
11 years ago
Solved

Hide number of posts in page title

The number of posts for a particular category node is displaying as (0), so I've hidden it in the text on the page. However, it's still appearing in the page title (the one that appears in the <head>). http://screencast.com/t/rlbVxXnTtEZh

 

Any tips?

  • Here's the Freemarker + Javascript solution to remove the (#) from the page titles of certain nodes. I place it in my hitbox content.

     

    <#if page.name?lower_case == "mobilecategorypage" >
       <#assign currentNodeId = coreNode.id />

       <#if currentNodeId == 'product' || currentNodeId == 'discussions'>
       //Remove (0) from page title on Help Forums and Support Node
       var pageTitle = document.title;
       document.title = pageTitle.replace(/\(.*?\)\s?/g, '');
       </#if>

    </#if>

5 Replies

  • DavidE's avatar
    DavidE
    Lithium Alumni (Retired)
    11 years ago

    I am sorry if this does not answer your question, but I have seen this issue before. The problem I saw was with the formatting of the date range in the search query. Freemarker tries to do number formatting that can mess up query parameters.

     

     

    numberVarialbe?int     =>     1,389,613,718 - 1,390,218,518        // broken
    numberVariable?c       =>     1389613718.664 - 1390218518.664       // broken
    numberVariable?int?c  =>     1389613718 - 1390218518      // correct
    

     Otherwise, would this help? http://lithosphere.lithium.com/t5/Pages-and-layouts/Change-the-community-page-title-without-impacting-other-pages/ta-p/72218Hard coding the title for that node might work.

  • iftomkins's avatar
    iftomkins
    Maven
    11 years ago

    Hi David, 

     

    Thanks! The first answer I don't understand, and I'm not sure I know how to change. Your 2nd answer sounds like a great idea, but the link is broken, and I can't find the article by searching (new lithosphere is a little different/confusing). If you could resend the link it would be much appreciated.

     

    - Alan

  • iftomkins's avatar
    iftomkins
    Maven
    11 years ago
    Thanks for the link! Great idea, but doesn't work because it's not on every category page. It's just on one particular node. Hm. I guess I'll just parse with Javascript on page load. Oh wells!
  • iftomkins's avatar
    iftomkins
    Maven
    11 years ago

    Here's the Freemarker + Javascript solution to remove the (#) from the page titles of certain nodes. I place it in my hitbox content.

     

    <#if page.name?lower_case == "mobilecategorypage" >
       <#assign currentNodeId = coreNode.id />

       <#if currentNodeId == 'product' || currentNodeId == 'discussions'>
       //Remove (0) from page title on Help Forums and Support Node
       var pageTitle = document.title;
       document.title = pageTitle.replace(/\(.*?\)\s?/g, '');
       </#if>

    </#if>