-
I was wondering how you would approach customizing views in Trifid based on the Entity type. For example, if a URI is a Person entity, the view should render with the photo of the person, and if a Organization entity is requested, the view should display a different layout with a map. We are using opaque URIs so there is no "path" that indicates the type of requested entity before hand. The ability to customize views based on entity type seems like a common pattern so I am sure there must be a way to do this elegantly with Trifid ;-). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@saumier The main work to render the triples in the html page is done by the template that injects the triples as JSON-LD into a |
Beta Was this translation helpful? Give feedback.
@saumier The main work to render the triples in the html page is done by the template that injects the triples as JSON-LD into a
script
element and the render-ld.js script, which creates the html. It would be possible to replace the standard renderer, if you want to replace the standard output with custom code. It's also possible to just add more js code for additional output. Maybe start with the last option, once you have something useful running, you can decide if you want to replace the default rendering. Here is an example js code that adds a map if there is a triples with the main subject and the predicatehttp://schema.org/hasMap
. The result looks like this.