Microdata itemscope attribute

t1merritt's Avatar

t1merritt

07 Oct, 2015 05:19 PM

Hello,

We are tagging up some of our markup with microdata and Cascade does not like the itemscope attribute because it is an attribute without an "=". What is the proper way to pass it through without the error, or without Cascade substituting itemscope="" ? We are referencing this via Format with Velocity.

Thank You.

  1. 1 Posted by Ryan Griffith on 07 Oct, 2015 06:30 PM

    Ryan Griffith's Avatar

    Hi,

    Curious, but did you try surrounding the code containing the attribute with a #protect tag? This should tell Cascade to skip over that content during XML validation.

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by t1merritt on 08 Oct, 2015 04:51 PM

    t1merritt's Avatar

    Hi Ryan,

    Yeah, tried it and Cascade is barking at it. Maybe I’m not quite implementing the #protect tag quite right. Tried it both ways, <!—#protect #protect—> and <![CDATA[#protect #protect]]>

    Here’s the line of code we are trying to accomplish with the attribute:

    <li class="$eventTypeClass” itemscope itemtype="http://data-vocabulary.org/Event”>

    Thanks much for any other suggestions.

  3. 3 Posted by Ryan Griffith on 08 Oct, 2015 07:15 PM

    Ryan Griffith's Avatar

    Hi,

    Where are you placing the code section tags? What error are you seeing?

    Thanks!

  4. 4 Posted by t1merritt on 08 Oct, 2015 10:32 PM

    t1merritt's Avatar

    I’m just wrapping the itemscope, like so:
    <li class="$eventTypeClass" <!—#protect itemscope #protect—> itemtype="http://data-vocabulary.org/Event">

    And, this is the error:
    An error occurred while rendering asset preview: Error on line 26: Element type "li" must be followed by either attribute specifications, ">" or "/>".

    This is the original error without the protect code:
    An error occurred while rendering asset preview: Error on line 26: Attribute name "itemscope" associated with an element type "li" must be followed by the ' = ' character.

    Thank You.

  5. 5 Posted by Ryan Griffith on 09 Oct, 2015 05:12 PM

    Ryan Griffith's Avatar

    Thank you for following up.

    Instead of wrapping the attribute, try to wrap the entire <li> and let me know how it works out:

    <!--#protect<li class="$eventTypeClass” itemscope itemtype="http://data-vocabulary.org/Event”>#protect-->
    

    If you need to see the list item, you could try the following. In some situations; however, the --> portion of the first #protect gets dumped to the page, but worth a shot.

    <!--#protect--><li class="$eventTypeClass” itemscope itemtype="http://data-vocabulary.org/Event”><!--#protect-->
    

    Please let me know if you have any questions.

    Thanks!

  6. 6 Posted by t1merritt on 12 Oct, 2015 04:03 PM

    t1merritt's Avatar

    Okay,

    So here’s the solution that worked. It’s a protect on the opening and the closing tag:

    <!--#protect
                        <li class="$eventTypeClass" itemscope itemtype="http://data-vocabulary.org/Event”>
    #protect—>
    
    — Code/Markup inside of list item —
    
    <!--#protect
                        </li>
    #protect—>
    

    Thanks much for your time, Ryan.

  7. Support Staff 7 Posted by Tim on 12 Oct, 2015 04:06 PM

    Tim's Avatar

    Thanks for the update and for posting your working solution! I'm glad Ryan was able to help you out. Have a good one!

  8. Tim closed this discussion on 12 Oct, 2015 04:06 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac