This PR introduces a new SchemaOrgView and SchemaOrg mode, updates views to use these new components, and removes redundant JSON-LD generation code. With management of JSON-LD centralized, added a check for the length of the description in the Dataset json-ld to adhere to Google's guidelines. It either truncates the description if it's above 5000 characters, or adds some text if the description is less than 50 characters.
In working on this, I found a few issues with the current JSON-LD generation that I also fixed in this PR:
The app config option isJSONLDEnabled, when false, now prevents all instances of schema.org
json-ld from being added in the app; previously it only applied to the Dataset json-ld, which seems to have been an oversight.
Fix issue where DataCatalog json-ld was empty if node metadata hadn't synced yet
Add missing DataCatalog json-ld for the DataCatalogView. Previously there was a method to do this, but it was never called.
Use the theme's jsonLD template as the default json-ld content when the current page doesn't have an specific schema.org json-ld content (i.e. it's not a Dataset landing page and not a DataCatalog). Previously, this content would only be shown on the very first page that a user lands on (and only if it wasn't a DataCatalog page or a Dataset landing page), then would be removed upon navigating to another page.
Fix a syntax error in the KNB theme's json-ld template. There was an extra } at the end of the template that was causing a parsing error.
This PR introduces a new
SchemaOrgView
andSchemaOrg
mode, updates views to use these new components, and removes redundant JSON-LD generation code. With management of JSON-LD centralized, added a check for the length of the description in the Dataset json-ld to adhere to Google's guidelines. It either truncates the description if it's above 5000 characters, or adds some text if the description is less than 50 characters.In working on this, I found a few issues with the current JSON-LD generation that I also fixed in this PR:
isJSONLDEnabled
, when false, now prevents all instances of schema.org json-ld from being added in the app; previously it only applied to the Dataset json-ld, which seems to have been an oversight.}
at the end of the template that was causing a parsing error.Fixes #1899