Feedback
 
Did this article resolve your question/issue?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful. Please provide us a way to contact you, should we need clarification on the feedback provided or if you need further assistance.

Characters Remaining: 1025

 


Article

MVC: Hide Content Block on Details Page

« Go Back

Information

 
Article Number000099966
EnvironmentProduct: Sitefinity
Version: 7.x, 8.x, 9.x, 10.x, 11.x, 12.x
OS: All supported OS versions
Database: All supported Microsoft SQL Server versions
Question/Problem Description

There is a dynamic module widget with a List/Details pages.There is a content block on the page, but it needs to be visible only on the List page, not on the Details page.

How to hide widgets in an auto-generated Details pages?

Steps to Reproduce
Clarifying Information
The Details page is auto-generated and it is best to be kept that way for SEO purposes.
Error Message
Defect/Enhancement Number
Cause
Resolution
This enhancement has not been implemented in the product.  As an alternative use one of the workarounds below.
Workaround
1. Add a wrapper CSS class around the Content Block, e.g. hide-on-details. Then, in the Details view of the dynamic module, define this class as display:none;

2. Hide it using JavaScript in the Details view template - check the URL in the script and hide the Content Block's part of the DOM tree based on a condition.

3. Implement a custom Content Block widget - since Feather widgets are open source, an own version of the Content Block widget might be implemented by applying minor modifications to reach the goal in mind:
- https://github.com/Sitefinity/feather-widgets/tree/master/Telerik.Sitefinity.Frontend.ContentBlock

4. Use a Sitefinity page instead of auto-generated ones - that will give the developer control over what's rendered on the Details page.
Notes
References to Other Documentation:
Feather widgets GitHub repo, Content Block, https://github.com/Sitefinity/feather-widgets/tree/master/Telerik.Sitefinity.Frontend.ContentBlock
Attachment 
Last Modified Date12/5/2019 8:42 AM