10 Replies Latest reply on Mar 11, 2015 4:58 AM by varunluthra

    How to update the Meta tags in Jive 6

    varunluthra

      Vishwajeet Joshi I hope you could help me out on this as well - We have an issue of duplicate meta content in our community. e.g. http://www.jive_community.com/community/custom_url has meta description as "This is a jive community space desc.", so a page inside this http://www.jive_community.com/community/custom_url/people is also having the same meta description. Is there a way we can update the meta content for the spaces and also for the other existing default pages? Where do we control all this in admin?

       

      A real example would be of jive's own community -Jive Developers and  /community/developer/people

      have same meta descriptions, but we need to have different for both, is it possible.

       

      We would love to have different meta content for different nested pages as well.

       

      Thanks

        • Re: How to update the Meta tags in Jive 6
          mcollinge

          We put a fair amount of effort into sorting this out on our Jive 6 community. We had to customise an .ftl file (header-meta.ftl) to make it possible, since it's not configurable out of the box. We edited some of the other files so that we didn't have the duplicate metadata section on the same page. There's no way to do this via the admin console.. it's purely by customisation.

            • Re: How to update the Meta tags in Jive 6
              varunluthra

              Thanks Matt Collinge - when you say you updated the .ftl, could you give some reference of the snippet which was updated in header-meta.ftl? A demo code would be appreciated.

               

              I found following in the default template:

               

              <#assign mKeywords = metaKeywords!"" mDescription=metaDescription!""/>

              <meta http-equiv="Content-Type" content="text/html; charset=${skin.template.characterEncoding}" />

              <#if mKeywords?has_content><meta name="keywords" content="${mKeywords?html}" /></#if>

              <#if mDescription?has_content><meta name="description" content="${mDescription?html}" /></#if>

              <meta charset="utf-8" />

              <!--[if IE]><![endif]-->

               

               

              So, what should I change in the above code instead of ${mDescription?html}.

               

              Do we need to make some more changes to the code as well or only above will do? And after that, how will we change the meta descriptions for this?

               

              Thank you once again for your help.

                • Re: How to update the Meta tags in Jive 6
                  mcollinge

                  What we ended up having to do is detect the different content types and use text from the content accordingly.. it ends up with us having close to a dozen IF statements to deal with how we want the metadata to show through for each type, e.g.

                   

                  <#if !e14OutputtedMetaTags && blog?exists && action.class.name=="com.jivesoftware.community.action.ViewBlogAction">
                      <link rel="canonical" href="${jive_base_absolute_url}${JiveResourceResolver.getJiveObjectURL(blog)}"/>
                      <meta name="title" content="<@s.text name="global.blog" />: ${tidyTitle} | element14.com" />
                      <meta name="description" content="<@s.text name="e14.metatag.readblog"><@s.param>${tidyTitle}</@s.param></@s.text>"/>
                      <meta name="keywords" content="<@jive.e14GetKeywords container blog />"/>
                      <#assign e14OutputtedMetaTags = true />
                  </#if>
                  
                    • Re: How to update the Meta tags in Jive 6
                      varunluthra

                      Thanks Matt Collinge - Did it require to update the core code as well or you did it all inside the template in admin itself? From the snippet you shared, what is e14OutputtedMetaTags and where is it defined? I understand Freemarker, but did it require you some Java coding as well in the customization? Could you provide the workflow for this customization. Basically, I want to know where do we keep the Meta descriptions, in the .ftl file?

                        • Re: How to update the Meta tags in Jive 6
                          mcollinge

                          e14OutputtedMetaTags is just a boolean we set in that template so that we don't end up getting multiple blocks of meta tags for any reason. We have other routines in that same ftl for tidying up the page title so that it looks how we want it to (via string manipulation).

                            • Re: How to update the Meta tags in Jive 6
                              varunluthra

                              So, you mean you've kept all the meta descriptions in if else blocks inside header-meta.ftl?

                                  • Re: How to update the Meta tags in Jive 6
                                    varunluthra

                                    Matt Collinge Thanks, can you share an extended bit of code, I am relatively new to Jive so don't have much experience. Also, is there a link to the documentation where I can find the context objects which I can use to find the page elements, URLs etc. Also, doing this customization would have 2 meta description tags, one default and one we added, right? So how do we encounter that.

                                     

                                    Also, I tried following code in my community but it didn't work:

                                     

                                    <#if request.getRequestURL() == "xyz.com">

                                    <link rel="canonical" href="${jive_base_absolute_url}${JiveResourceResolver.getJiveObjectURL(blog)}"/>

                                        <meta name="title" content="<@s.text name="global.blog" />: ${tidyTitle} | element14.com" />

                                        <meta name="description" content="<@s.text name="e14.metatag.readblog"><@s.param>${tidyTitle}</@s.param></@s.text>"/>

                                        <meta name="keywords" content="<@jive.e14GetKeywords container blog />"/>

                                        <#assign e14OutputtedMetaTags = true />

                                    </#if>

                                      • Re: How to update the Meta tags in Jive 6
                                        mcollinge

                                        We detect the type of object being used, rather that looking at the URL. We then did a bunch of work to determine what were the ideal meta tags to output for our Community.. which might not necessarily be the same for all communities. The objects can be checked like this;

                                         

                                        <#if document?exists>
                                        :
                                        :
                                        
                                        <#if !e14OutputtedMetaTags && video?exists>
                                        :
                                        :
                                        
                                        <#if !e14OutputtedMetaTags && event?exists>
                                        :
                                        :
                                        
                                        <#if !e14OutputtedMetaTags && poll?exists>
                                        :
                                        :
                                        
                                        <#if !e14OutputtedMetaTags && profile?exists>
                                        :
                                        :
                                        
                                        <#if !e14OutputtedMetaTags && container?exists && container.ID!=1 && (container.objectType==14 || container.objectType==700)>
                                        :
                                        :
                                        

                                         

                                        etc.

                                         

                                        Then it's up to you to fill in what meta tags you want to output for your community. We chose to bring in a snippet of text from the body, but you might want to do something different. Access to the Java source code helps you work out what you can call to get at the text you need.