Announcement

Collapse
No announcement yet.

Customizing meta description and keywords from custom fields

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Customizing meta description and keywords from custom fields

    In Miva 5, I'm trying to creating custom meta description and meta keywords for the PROD page based on data stored in custom fields.

    Essentially, for an items, if the Artist (S_ARTIST) = "Unknown", I do not want the Artist Name to be includes in the description or keywords. If the name is anything else (like "Joe Smith"), it should be included in the description and keywords.

    Here is my code that doesn't work:

    <mvt:if expr="mvt:product:customfield_values:customfields: S_ARTST EQ 'Unknown'">
    <meta name="description" content="SCrystal &mvt:product:customfield_values:customfields:S_NAM E; - &mvt:product:customfield_values:customfields:S_NUM ; & more SCrystal crystal figurines at Our Company Site &mvt:product:code;.">
    <meta name="keywords" content="SCrystal &mvt:product:customfield_values:customfields:S_NAM E;, SCrystal &mvt:product:customfield_values:customfields:S_NUM ;">
    <mvt:else>
    <meta name="description" content="SCrystal &mvt:product:customfield_values:customfields:S_NAM E; - &mvt:product:customfield_values:customfields:S_NUM ; by &mvt:product:customfield_values:customfields:S_ART ST; & more SCrystal crystal figurines at Our Company Site &mvt:product:code;.">
    <meta name="keywords" content="SCrystal &mvt:product:customfield_values:customfields:S_NAM E;, SCrystal &mvt:product:customfield_values:customfields:S_NUM ;, SCrystal &mvt:product:customfield_values:customfields:S_ART ST;">
    </mvt:if>

    The IF condition is always failing and it executes the ELSE part of the IF.

    (Once this is working, I'd like to change the condition to if Artist = "Unknown" or "Team", don't include it in the description or keywords, but since this code is not working, I'm trying to keep the problem simple.)

    Can anyone tell me what's wrong with the condition so that I get the results I want?

    Thanks,
    AM

    #2
    Re: Customizing meta description and keywords from custom fields

    There is a syntax issue in the initial condition, change mvt: to l.settings:


    Code:
    <mvt:if expr="l.settings:product:customfield_values:customfields:S_ARTST EQ 'Unknown'">
    Last edited by Dan - Glendale Designs; 07-07-14, 12:01 PM.

    Comment


      #3
      Re: Customizing meta description and keywords from custom fields

      Hi,

      Thanks for the suggestion, but that didn't seem to work.

      It is still failing the test and excuting the ELSE part of the IF.

      Any other suggestions?

      Thanks,
      AM

      Comment


        #4
        Re: Customizing meta description and keywords from custom fields

        Is the custom field in question enabled under the Pages > PROD (Product Display) > Product Display Layout?

        Comment


          #5
          Re: Customizing meta description and keywords from custom fields

          Yes, the field (S_ARTST) is SELECTED in the Product Layout.

          It (HTML) does display the Artist's name in the Meta Keywords and in the Meta Description per the code from my original post that includes code....it's just that I'm not able to test the contents of the field(?)

          Here is a page with an "Unknown" Artist: http://crystalexchange.com/p-23586.html

          Here is a page with a named Artist: http://crystalexchange.com/p-46501.html

          I appreciate the time you are taking to help me figure this out.

          AM

          Comment


            #6
            Re: Customizing meta description and keywords from custom fields

            Hard to say without seeing the specifics at this point. If the S_ARTST custom field is populated with a value of "Unknown", then the following should fire:

            Code:
            <mvt:if expr="l.settings:product:customfield_values:customfields:S_ARTST EQ 'Unknown'">
            If it is blank and a conditional was used to display "Unknown" if the contents were empty, then the following should work:

            Code:
            <mvt:if expr="l.settings:product:customfield_values:customfields:S_ARTST">
            ...or

            Code:
            <mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields:S_ARTST">

            Comment


              #7
              Re: Customizing meta description and keywords from custom fields

              My bad......

              I had
              l.settings:customfield_values ......
              instead of
              l.settings:product:customfield_values ..............
              in the testing condition.

              It works now!

              Thank you so much!!!

              AM

              Comment

              Working...
              X