Forum for discussing general topics related to Couch.
7 posts Page 1 of 1
Hi

I have having trouble with the SEO meta tags within a clonable template

in my gallery.php which is the clonable template, I am using globals.php to set the title, my gallery.php looks like the following

Code: Select all
<?php require_once'cms/cms.php'; ?>
<cms:pages masterpage='globals.php' >
<cms:set g_site_name=site_name 'global' />
</cms:pages>
<cms:template title='Gallery' clonable='1' dynamic_folders='1' gallery='1'>
   <cms:editable
      name='gg_image'
      label='Image'
      desc='Upload your main image here'
      width='500'
      height='500'
      show_preview='1'
      preview_height='200'
      type='image'
   />
   
   <cms:editable
      name='gg_thumb'
      label='Image Thumbnail'
      desc='Thumbnail of the main image above'
      width='115'
      height='115'
      enforce_max='1'
      assoc_field='gg_image'
      show_preview='1'
      type='thumbnail'
   /> 

   <cms:editable
      name='my_thumb_2'
      label='Image Thumbnail 2'
      desc='Second thumbnail of the main image above'
      width='100'
      height='100'
      assoc_field='gg_image'
      show_preview='1'
      type='thumbnail'
   /> 
   
   <cms:editable
      name='my_desc'
      label='Description'
      height='60'
      type='textarea'
   />
               
</cms:template>

<title><cms:show g_site_name/></title>

<cms:embed 'header.php' />

<!--CONTENT-->

<div id="column-top">

<div id="gallery-wrapper">

<div id="breadcrumbs">
      <cms:breadcrumbs separator='&nbsp;&raquo;&nbsp;' include_template='1'/><cms:if k_is_page>&nbsp;&raquo;&nbsp;<cms:show k_page_title /></cms:if>
   </div><!-- breadcrumbs -->

   <cms:if k_is_list >
     
      <!-- gallery folders -->
      <cms:ignore>
         NOTE: A few points to note about the way folders are displayed -
         1. We display only the immediate child folders of the current folder (root is also considered a folder).
         If the images in the current folder are numerous enough to need pagination, we take care to display the folders
         only on the first page.
         2. If the folder has an image associated with it (via the 'Manage folders' admin section), that image is used.
         If no image is associated, we pick up the first page contained within this folder and use its thumbnail.
         Finally if there are no child pages within, we use a default folder icon.
      </cms:ignore>
     
      <cms:set my_page="<cms:gpc 'pg' method='get' />" />
      <cms:if my_page lt '2' >
         <ul class="gallery folders">
            <cms:folders childof=k_folder_name hierarchical='1' depth='1'>
           
               <cms:set my_folder_image="" />
               <cms:if k_folder_image>
                  <cms:set my_folder_image=k_folder_image />
               <cms:else />
                  <cms:pages folder=k_folder_name include_subfolders='0' limit='1'>
                      <cms:set my_folder_image=my_thumb_2 scope='parent' />
                  </cms:pages>
               </cms:if>
               <cms:if my_folder_image=''><cms:set my_folder_image="<cms:show k_admin_link />theme/images/empty-folder.gif" /></cms:if>
               
               <li>
                  <a href="<cms:show k_folder_link />">
                     <img alt="<cms:show k_folder_title />" src="<cms:show my_folder_image />"/>
                     <span class="title"><cms:show k_folder_title /></span>
                     <span class="count_images"><cms:show k_folder_totalpagecount /> images</span>
                     
                  </a>
               </li>
            </cms:folders>
         </ul>   
      </cms:if>
     
      <!-- gallery images-->
      <ul class="gallery">
         <cms:pages folder=k_folder_name include_subfolders='0' limit='18' paginate='1'>
            <li>
               <a href="<cms:show gg_image />" rel="lightbox-<cms:show k_page_foldername/>" <cms:if my_desc>title="<cms:show my_desc/>"</cms:if>>
                  <img alt="<cms:show k_page_title />" src="<cms:show my_thumb_2 />"/>
               </a>
            </li>
           
            <cms:if k_paginated_bottom ><!-- pagination -->
               <div style="clear:both"><cms:paginator /></div>   
            </cms:if>
           
         </cms:pages>
      </ul>
 
   <cms:else /><!-- k_is_page -->   
     
      <div id="image_container">
         <img alt="<cms:show k_page_title />" src="<cms:show gg_image />"/>
      </div>
     
   </cms:if>

</div>
   
<br class="clear" />

</div> <!-- COLUMN TOP-->
   
<!--CONTENT-->

<div class="clearfooter"></div>

<?php include( 'includes/footer.php' ); ?>
<?php COUCH::invoke(); ?>


my header.php in the snippets folder looks like the following

Code: Select all
<meta name="keywords" content="<cms:show meta_keywords />">
<meta name="description" content="<cms:show meta_description />">


my globals.php looks like the following

Code: Select all
<?php require_once ( 'cms/cms.php' ); ?>
<cms:template title='Global Settings' executable='0'>
<cms:editable name='site_name' label='Gallery Page Title' type='text'>Gallery</cms:editable>

<cms:editable name='meta_keywords' label='Meta Keywords - 7-8 max comma separated' type='text' />
<cms:editable name='meta_description' label='Meta Description - 180 words max' type='textarea' />

</cms:template>
<?php COUCH::invoke(); ?>


on the Global Settings on the admin side of the CMS shows the meta keywords field and the meta description textarea box so have entered them in but on the gallery.php page, it is showing the following when I look at the view source

<meta name="keywords" content="">
<meta name="description" content="">

I don't get where I have gone wrong?

I am determined to get it working but just can't see why the gallery.php is not picking up on the meta tags when I have set them in the globals.php page and made the gallery.php use the globals.php settings?
Did you try ?

Code: Select all
<cms:pages masterpage='globals.php' >
<meta name="keywords" content="<cms:show meta_keywords />">
<meta name="description" content="<cms:show meta_description />">
</cms:pages>
I load frameworks and write bugs on top of them, after that I rearrange the code so that it looks like a cool product.
No I did't try that way, thank you really appreciate it

Will try that way and post a update
Hi Tomarnst

I just had a thought, would the following coding use the same keywords and descriptions for each page as is using globals.php am guessing that code goes in the header.php in the snippets folder, is that right?

Code: Select all
<cms:pages masterpage='globals.php' >
<meta name="keywords" content="<cms:show meta_keywords />">
<meta name="description" content="<cms:show meta_description />">
</cms:pages>
@ianhaney
.. and made the gallery.php use the globals.php settings?
If we 'expand' the header.php snippet in-place, following is what your code becomes -
Code: Select all
<cms:pages masterpage='globals.php' >
    <cms:set g_site_name=site_name 'global' />
</cms:pages>
..
<title><cms:show g_site_name/></title>

<meta name="keywords" content="<cms:show meta_keywords />">
<meta name="description" content="<cms:show meta_description />">

As you can see, you are retrieving only one field (site_name) from 'globals.php'.
The 'meta_keywords' and 'meta_description' have no connection whatsoever with 'globals.php'.


As @Tomarnst suggested, to fetch then from 'globals.php' you can either modify your code to make it -
Code: Select all
<cms:pages masterpage='globals.php' >
    <cms:set g_site_name=site_name 'global' />
</cms:pages>
..
<title><cms:show g_site_name/></title>

<cms:pages masterpage='globals.php' >
   <meta name="keywords" content="<cms:show meta_keywords />">
   <meta name="description" content="<cms:show meta_description />">
</cms:pages>

Or (to avoid using the cms:pages loop twice as we did above) you can do the following -
Code: Select all
<cms:pages masterpage='globals.php' >
    <cms:set g_site_name=site_name 'global' />
    <cms:set g_meta_keywords=meta_keywords 'global' />
    <cms:set g_meta_description=meta_description 'global' />
</cms:pages>
..
<title><cms:show g_site_name/></title>

<meta name="keywords" content="<cms:show g_meta_keywords />">
<meta name="description" content="<cms:show g_meta_description />">

Hope it helps.
guessing that code goes in the header.php in the snippets folder, is that right?
Yes it does.

would the following coding use the same keywords and descriptions for each page as is using globals.php
Yes it's not desirable to have more than one page with the same description .... google doesn't like that. You could use some other variable of your page to avoid this, maybe make a field seo-description in your gallery.php and use that one.
I load frameworks and write bugs on top of them, after that I rearrange the code so that it looks like a cool product.
Hi

Thank you both

I will try the ways mentioned, thank you KK and Tomarnst

will post a update in a bit
7 posts Page 1 of 1