google / google/react-schemaorg
Script not showing up in page source
- Vorherrschende Sprache
- TypeScript
- Sterne
- 521
- Forks
- 20
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Hi,
I'm new to this, so maybe I'm missing something... I'm under the impression that the point of this library is to be able to insert JSON-LD in any functional component, and also be readable by Google Rich Results (that apparently will replace GDT).
I have inserted this sample in my functional component, displayed when I'm at localhost:3000/integrations (redirection handled via React Router. This is a single JSON-LD object, but eventually there will be a loop to create multiple ones with variables. The "name" property already has a variable as it's value, as you can see below.
```
return (
item={{
"@context": "https://schema.org",
"@type": "Person",
"address": {
"@type": "PostalAddress",
"addressLocality": "Colorado Springs",
"addressRegion": "CO",
"postalCode": "80840",
"streetAddress": "100 Main Street"
},
"colleague": [
"http://www.example.com/JohnColleague.html",
"http://www.example.com/JameColleague.html"
],
"email": "info@example.com",
"image": "janedoe.jpg",
"jobTitle": "Research Assistant",
"name": name,
"alumniOf": "Dartmouth",
"birthPlace": "Philadelphia, PA",
"birthDate": "1979-10-12",
"height": "72 inches",
"gender": "female",
"memberOf": "Republican Party",
"nationality": "Albanian",
"telephone": "(123) 456-6789",
"url": "http://www.example.com",
"sameAs" : [ "https://www.facebook.com/",
"https://www.linkedin.com/",
"http://twitter.com/",
"http://instagram.com/",
"https://plus.google.com/"]
}}
/>
)
```
However, when I check the page source, I only get the contents of my index.tsx which is the standard React prebuilt code with the root div where the App component goes. My question is this: Where do the inserted scripts go when I use the JSONLd component? Because when I go run them in the validator, they are not found.
Thank you!
Beitragsleitfaden
Rechercherichtung
Den Bericht unter localhost:3000/integrations mit der gezeigten JsonLd-Komponente reproduzieren und index.tsx sowie den Quelltext der gerenderten Seite untersuchen. Vergleichen, was im Quelltext erscheint, mit dem, was der Validator empfängt. Als erledigt gilt die Aufgabe, wenn das Verhalten erklärt ist und das JSON-LD entweder wie erwartet auffindbar ist oder das Issue die erforderliche Verwendung dokumentiert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- react, typescript
- Bereich
- frontend, web-dev
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 35/100