Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding json-ld script tags (dynamic) in SSR pages #52

Closed
thereviewindex opened this issue Jul 21, 2017 · 1 comment
Closed

Adding json-ld script tags (dynamic) in SSR pages #52

thereviewindex opened this issue Jul 21, 2017 · 1 comment

Comments

@thereviewindex
Copy link

thereviewindex commented Jul 21, 2017

Hi, I need to add script tags (to indicate JSON-LD structured data) to the Head tag, dynamically for each page, just like title/description/meta tags. What is the recommended way to do this?

Example -

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [{
    "@type": "ListItem",
    "position": 1,
    "item": {
      "@id": "https://example.com/books",
      "name": "Books",
      "image": "http://example.com/images/icon-book.png"
    }
  },{
    "@type": "ListItem",
    "position": 2,
    "item": {
      "@id": "https://example.com/books/authors",
      "name": "Authors",
      "image": "http://example.com/images/icon-author.png"
    }
  }
  }]
}
</script>
@catamphetamine
Copy link
Owner

https://stackoverflow.com/a/30956615/970769

The data, enclosed within the <script type="application/ld+json"> ... </script> tags as shown in the examples below, may be placed in either the or region of the page that displays that event.

Therefore no need to place it in head, place it inside page components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants