6 Replies Latest reply on Jul 3, 2013 8:30 AM by CQHondo

    Delete Predefined   Templates

    patK Level 1

      In CQ WCM , when I create a new page , I get an option to choose Template. I created some very basic templates while playing with Component devlopment. Is there a way to delete these predefined templates ?

       

      Where is th option to delete these predefined templates

       

      Untitled.png\

        • 1. Re: Delete Predefined   Templates
          Ove Lindström Level 4

          Use CRXDE/CRXDE Lite, find the templates that you have defined, delete them.

          • 2. Re: Delete Predefined   Templates
            bulan_

            To remove predefined templates (Blog, Form Template) remove this paths in crxde:

            /libs/collab/commons/templates/form

            /libs/collab/blog/templates/page

             

            To remove your templates:

            1) Create page with template to remove (to check template path)

            2) Check template path in crxde: /content/your_app/your_page/jcr:content in property cq:template

            3) Remove template path (and temporary page)

            • 3. Re: Delete Predefined   Templates
              Ove Lindström Level 4

              I would acctually, when I think about it, use another solution. I would restrict the user/group that are to use the system from using that template or I would configure the templates I use to allow just a named set of templates using allowChildren/allowParents/allowedPaths. See http://dev.day.com/docs/en/cq/current/developing/templates.html.

              • 4. Re: Delete Predefined   Templates
                CQHondo

                To remove the predefined templates, blog and form template, bulan_'s solution works but it goes against the best practice of never touching anything in the /libs folder.  This is also the case of Ove's solution.

                 

                Does anyone have a different solution to restrict these predefined templates? 

                • 5. Re: Delete Predefined   Templates
                  orotas Level 4

                  Well it may not qualify as removing them, but one way to acheive this is to put a cq:allowedTemplates property on the top node of you site heirarchy. So for example if you site is located below /content/mysite and all of your templates were located in /apps/mysite/template/ you could add a property to /content/mysite/jcr:content named cq:allowedTemplates and set it equal to /apps/mysite/templates/*. That would prevent any templates other than your custom templates from showing up. See http://dev.day.com/docs/en/cq/current/developing/templates.html#Template Availability for a more detailed review of all the factors that can influence template availabitlity. You can see the impact of this setting at play by looking at the differences when creating a new page in the various Geomettrix demo sites (most of which have the cq:allowedTemplates set at the top level).

                   

                  A less prefereable solution would be to deny read access to templates in question - but that could cause other potential problems.

                  • 6. Re: Delete Predefined   Templates
                    CQHondo Level 1

                    Thank you, orotas.  This is the correct solution to the original issue. The regex needed to be adjusted, but this worked great.

                     

                    So, to recap:

                    Add a "cq:allowedTemplates" String[] property to "/content/mysite/jcr:content" and set it to "/apps/mysite/templates/.*"