Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom Maton 387 posts 660 karma points
    Dec 10, 2015 @ 21:21
    Tom Maton
    0

    Using Google Schema's creates an error on page

    Hey all,

    I'm hoping this is a simple question for you smart lot out there. I'm implementing Google Schema's (https://developers.google.com/schemas/formats/json-ld) into a clients site using the JSON route.

    <script type="application/ld+json">
        { 
            "@context" : "http://schema.org",
            "@type" : "Organization",
            "name" : "[organization name]",
            "logo" : "[logo image url]",
            "url" : "[website url]",
            "sameAs" : [
                "https://twitter.com/[username]",
                "https://www.facebook.com/[username]",
                "https://www.linkedin.com/company/[username]",
                "https://plus.google.com/[username]/posts"
            ]
        }
    </script>
    

    When I've tried to implement this I get the following error message:

    The name 'context' does not exist in the current context
    

    Any help would be greatly appreciated.

  • Ian 178 posts 752 karma points
    Dec 10, 2015 @ 21:40
    Ian
    101

    A guess but is this placed somewhere in Razor view or layout where the @ symbol has special meaning so it is trying to treat 'context' as a variable? If so it might need escaping so I believe @ becomes @@. Sorry if I'm way off.

  • Tom Maton 387 posts 660 karma points
    Dec 10, 2015 @ 21:53
    Tom Maton
    0

    Ian you was spot on escaping it with double @ worked. I was trying to escape it with .

    Working with to much JS lol.

Please Sign in or register to post replies

Write your reply to:

Draft