Forum Discussion

allisonn's avatar
allisonn
Genius
10 years ago

Removing components from templates

We have a component on almost every page type we would like to remove. Is the only way to do this to go page type by page type and manually x it off the page? At this point we don't want to delete the component, we may want to utilize it later. Does anyone else have any suggestions on how to remove it in a more bulk way?

 

Worst case scenerio, we could copy the code into a new component and delete it out of this one so it's essentually blank and repopulate if we decide to use it again, but that is really a last resort right?

8 Replies

  • allisonn's avatar
    allisonn
    Genius
    10 years ago
    It is a custom component. So you are saying I can create a new component of the same name with @override leave it blank, that will make the current component blank globally and if ever want to put it back, we just delete the @override component?
  • DougS's avatar
    DougS
    Khoros Oracle
    10 years ago
    I will test to see if you can use @Override with custom components. if you can't, you could just blank out the custom component: You could either move the content to another custom component that you don't have placed on any page, or comment out the code using a freemarker comment:

    <#-- a freemarker comment -->

    -Doug
  • allisonn's avatar
    allisonn
    Genius
    10 years ago
    Thanks Doug! It looks like the @overide does work for custom components.
  • luk's avatar
    luk
    Boss
    10 years ago

    If you need the original custom component to show somewhere (but not everywhere else) you could also add a FreeMarker if statement that checks for the page you're currently on and then decide to display or not display the component based on that. The "page" context object should give you what you need for that (essentially the page name like "CommunityPage").

  • luk's avatar
    luk
    Boss
    10 years ago

    DougS: Could you check if @override also works for non-contract components? Had the "post-list" (found on RecentPostsPage quilt) throw an error when trying to use @override, e.g. post-list@override didn't work...

     

    Additionally it seems that the character limit of the "new component" modal window input (for the component name) is too low to even override all default components (which should be possible IMHO), e.g. it's not possible to override for example the "recommendations.widget.recommended-content-taplet" with a component named "recommendations.widget.recommended-content-taplet@override" because that exceeds the character limit of 50 chars...I think it would be good if that limit is set to the longest name of any default (contract or non-contract) component + 9 chars (for @override).