Feedback
Did this article resolve your question/issue?

   

Article

MVC: Hide Content Block on Details Page

« Go Back

Information

 
TitleMVC: Hide Content Block on Details Page
URL Namemvc-hide-content-block-on-details-page
Article Number000164113
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
Last Modified Date12/5/2019 8:42 AM
Attachment 
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.