Announcement

Collapse
No announcement yet.

Custom Alt tag

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

    Custom Alt tag

    Is there a way to create a custom image field? Something I can use for the image alt tag. Normally the image alt tag is filled with the image name. I'm looking for more control over what the img alt tag holds.

    Using the image machine I might have 3 images of a product and the main keyword phrase is 'bike seat'. What if I wanted the alt tags to also hold a secondary keyword phrase such as:
    <img src="graphics/bike-seat-1" alt="black leather bike seat">
    <img src="graphics/bike-seat-2" alt="professional bike seat">
    <img src="graphics/bike-seat-3" alt="custom fit bike seat">

    I guess I'm looking for a way to fine tune the alt tag for SEO reasons without having to change the image name.
    Gary

    [email protected]
    www.icCommerce.com

    #2
    Re: Custom Alt tag

    Glad you asked - because the ALT tag is supposed to describe the image itself. Yes, you can create a custom field and then code it to display for the image itself.

    In the PROD template you'll see a line like this:
    <span data-icon="&#x54;" id="js-main-image-zoom" class="main-image" data-index="0"><img src="graphics/en-US/cssui/blank.gif" alt="&mvte:product:name;" title="&mvte:product:name;" id="js-main-image" data-image="&mvt:product:customfield_values:productimag ecustomfields:main;" /></span>

    You want to call the custom field where it currently displays: &mvte:product:name;
    Best,
    Pamela

    Consultant / Developer / Trainer
    Contributing Editor to Practical Ecommerce
    Author of the Official Guides for Miva Merchant
    pamelahazelton.com

    Comment


      #3
      Re: Custom Alt tag

      Disclaimers: I can't offer a copy-and-paste solution here, because the exact implementation of this idea will depend on your store's existing setup. Also, depending on your level of coding skill, this may not be the best option for you.

      It sounds like you want multiple values, one for each image assigned to your product. I ran into this same issue recently, and really wish there was a built-in solution. I ended up creating a custom product field and made the value a delimited list of the text I wanted associated with each image. Implementing this can be a bit tedious, but it gets the job done.

      So for instance, lets say there are three images assigned to a product, like in your example. First, create your custom field. I called mine custom_images_meta and made it a text area for readability. For each product, you can then add your image alt values like so:

      black leather bike seat#
      professional bike seat#
      custom fit bike seat#

      The "#" character is what I use as a delimiter since I use commas and pipes in my data (slightly different usage from yours). You could just as easily use commas or a pipe or whatever you like. Then, the template code needs to parse this custom field value by splitting it by that delimiter character, then use a loop that lets you assign the values to your images.

      As a side note, since I hit enter to add a line break in between each entry in my custom field's value (so it's easier to read), I have to remove that from the data before working with it:

      Code:
      <mvt:assign name="g.imagesmeta" value="l.settings:attributemachine:product:customfield_values:customfields:customer_images_meta"/>
      <mvt:assign name="g.imagesmeta" value="glosub(g.imagesmeta, asciichar(10),'')"/>
      <mvt:assign name="g.imagesmeta" value="glosub(g.imagesmeta, asciichar(13),'')"/>
      The ASCII characters 10 and 13 are the line feed and carriage return. The code above just removes those from the value and assigns the result to g.imagesmeta.

      I'm not going to venture into more code here at this time, because it might be confusing if the code I wrote for my purposes doesn't match the needs of your template (assuming I haven't made this too confusing already). Hopefully this will at least give you an idea and point you in the right direction for what you need. If you need further clarification on anything, though, I'd be happy to help as best I can. The bottom line, though, is that it can definitely be done.


      Josh

      Comment


        #4
        Re: Custom Alt tag

        Thanks Josh, you're right I'm looking for a way to assign a meta value to each image and I see how your solution can work. I hope Miva will consider building this in. I like the way Wordpress does this, all images listed in a media library and if you click to edit the image there are input fields for caption, alternative text and description. That would make my SEO a lot easier.
        Gary

        [email protected]
        www.icCommerce.com

        Comment


          #5
          Re: Custom Alt tag

          This feature is definitely on our road map to build in to Miva, when we make the next update to image machine. It will include the ability to add all the thing you want above : image titles, alt tags and captions among other updates.
          Brennan Heyde
          VP Product
          Miva, Inc.
          [email protected]
          https://www.miva.com

          Comment


            #6
            Re: Custom Alt tag

            Thanks, Brennan. I think that will be a great addition to the platform.

            Comment


              #7
              Originally posted by Brennan View Post
              Re: Custom Alt tag

              This feature is definitely on our road map to build in to Miva, when we make the next update to image machine. It will include the ability to add all the thing you want above : image titles, alt tags and captions among other updates.
              So now when is the next update to the Image Machine coming out?
              Leslie Kirk
              Miva Certified Developer
              Miva Merchant Specialist since 1997
              Previously of Webs Your Way
              (aka Leslie Nord leslienord)

              Email me: [email protected]
              www.lesliekirk.com

              Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

              Comment


                #8
                Hey Brennan,

                I have a client's need to give captions (/alt tags) to each image delivered by the image machine.

                It was meant to be on the roadmap but I don't see that it has ever been done. When do you think this is likely?

                Cheers,
                Michael

                Comment


                  #9
                  FYI. It would be better SEO to have a descriptive image name verses just changing the Alt Tag. For example, /best-professional-bike-seat.jpg and professional-bike-seat-stem-closeup.jpg.
                  Bruce Golub
                  Phosphor Media - "Your Success is our Business"

                  Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                  phosphormedia.com

                  Comment


                    #10
                    Indeed - thanks Bruce.

                    In our case, I need to caption images from various tourist sites and so I would actually want all that Brennan had originally described:
                    • Image Titles - for good SEO
                    • Alt Tags - for good SEO
                    • Captions - a more flowery (visual) description for the customer
                    Our images' filenames also are named in the manner you describe.

                    All of this would achieve every need for customers and search engines, etc. I'm just hoping that this hasn't fallen off the roadmap.

                    cheers,
                    Michael

                    Comment


                      #11
                      Agreed. Image management overall needs vast improvement. I know they've already done (in dev) some work along the lines of image management so maybe this will be in there as well. However, I believe not until v10, which is at least sometime next year.
                      Bruce Golub
                      Phosphor Media - "Your Success is our Business"

                      Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                      phosphormedia.com

                      Comment

                      Working...
                      X