sitefinitysitefinity-10

Sitefinity widgets not showing on News Detail page


Inherited a Sitefinity website. There's a news list page, which I discovered is reused by the news detail pages to display content. If I update the list page, the changes are reflected on the detail pages.

Sometimes.

I have a content block that contains a "header" text - updating this in the list page is replicated across the details pages. Adding a javascript widget to the page to inject some custom javascript replicates across the details pages as well.

Adding a new content block or css widget does not replicate across the details pages.

Is there some rhyme or reason to this behavior that I'm missing?


My specifics:

I've successfully created widgets in the MVC several times now. I essentially need to add a new widget to just the news pages. Which seemed simple enough until I discovered that news pages are not individually created pages like... well, pages... but instead are just a content piece that is dynamically inserted in the news widget on the "parent" listing page. At least as far as I can tell that's how it appears to be working.

Adding my widget to the page didn't work, as I explained above. I then tried recreating it in the page itself using javascript, content block, and css widgets, at which time I discovered that the javascript is the only one making it to the details pages. I imagine this has to do with the way javascript widgets actually make it to the page - their placement is selected in advanced options, rather than simply appearing inline.


Solution

  • Sitefinity widgets go beyond presentation, and actually control routing.

    As such content widgets (baseline or custom) have two 'modes' that they operate in: list and detail. Slugs for details are automatically generated in the following format.

    /News
    /News/{News-item-slug}
    

    Of course, a list and a detail should look very different. To accommodate that, the widgets have two separate configurable templates.

    So, add your custom html and javascript to the appropriate template to have it only apply in a given mode.