Forum for discussing general topics related to Couch.
10 posts Page 1 of 1
Hello

Please how can I create top level pages from the admin panel e.g pages like my website.com/privacy - policy

Is this possible in couch
Thank you! I'll try it out

I have tried it and for some reason I don't know, it does not work

I followed every step and it didn't work
@KK
@SimonWpt, the solution you mentioned would help in creating copies of pages from a *clonable* template (e.g. create a new blog post with the same contents as another existing post).

I think, that is not quite what @Israel is looking for.

@Israel, to create pages like 'contact' or 'about-us' (which normally would require using separate non-clonable templates), you can instead use a single 'Nested pages' template (https://docs.couchcms.com/concepts/nest ... maker.html) named 'index.php'.

Now, previously, this approach had practical limitations because each of the pages of this template would have exactly only those editable regions as defined in the template. Obviously, the contact page would require a different set of regions than that required by the about-us page.

Now, however, you can use the 'Mosaic' feature to define several different sets of editable regions in the same template then pick and select one (or several) of those sets in each page that you create.

Please see '4. Mosaic' section in the following post for details on mosaic, if you haven't come across it yet.

Hope this helps.
Hi @Israel

Sorry to jump on the post but may have something that could help do what your looking for that can allow you to create pages from the admin panel and choose different layouts

Your index.php page would have the following code on it

Code: Select all
<cms:template title='Create pages with layouts' clonable='1' nested_pages='1'>
   
<cms:editable
        type='checkbox'
        name='two_column'
        label='Do you want two column layout?'
        opt_values='Yes'
        order='-1'
/>
   
<cms:func _into='two_columns' two_column=''>
    <cms:if "<cms:is 'Yes' in=two_column />">
            show
    <cms:else />
            hide
    </cms:if>
</cms:func>
<cms:editable name='two_column_layout_one' type='row' not_active=two_columns order='3'>
    <cms:editable name='two_column_layout_one_cardsoneheading' label='Card One Heading' type='text' />
    <cms:editable name='two_column_layout_one_cardsonetext' label='Card One Text' type='richtext' class='col-md-6 mb-6' />
    <cms:editable name='two_column_layout_one_cardsonebuttontext' label='Card One Button Text' type='text' />
    <cms:editable name='two_column_layout_one_cardstwoheading' label='Card Two Heading' type='text' />
    <cms:editable name='two_column_layout_one_cardstwotext' label='Card Two Text' type='richtext' class='col-md-6 mb-6' />
    <cms:editable name='two_column_layout_one_cardstwobuttontext' label='Card Two Button Text' type='text' />
</cms:editable>

<cms:editable
        type='checkbox'
        name='three_column'
        label='Do you want three column layout?'
        opt_values='Yes'
        order='1'
/>
   
<cms:func _into='three_columns' three_column=''>
    <cms:if "<cms:is 'Yes' in=three_column />">
            show
    <cms:else />
            hide
    </cms:if>
</cms:func>
<cms:editable name='three_column_layout_two' type='row' not_active=three_columns order='4'>
    <cms:editable name='three_column_layout_two_cardoneheading' label='Card One Heading' type='text' />
    <cms:editable name='three_column_layout_two_cardonetext' label='Card One Text' type='richtext' class='col-md-4 mb-4' />
    <cms:editable name='three_column_layout_two_cardonebuttontext' label='Card One Button Text' type='text' />
    <cms:editable name='three_column_layout_two_cardtwoheading' label='Card Two Heading' type='text' />
    <cms:editable name='three_column_layout_two_cardtwotext' label='Card Two Text' type='richtext' class='col-md-4 mb-4' />
    <cms:editable name='three_column_layout_two_cardtwobuttontext' label='Card Two Button Text' type='text' />
    <cms:editable name='three_column_layout_two_cardthreeheading' label='Card Three Heading' type='text' />
    <cms:editable name='three_column_layout_two_cardthreetext' label='Card Three Text' type='richtext' class='col-md-4 mb-4' />
    <cms:editable name='three_column_layout_two_cardthreebuttontext' label='Card Three Button Text' type='text' />
</cms:editable>
   
</cms:template>


Then inside the html would be the following

Code: Select all
<cms:if two_column>
          <cms:embed 'two-column-layout.html'/>
       <cms:else />
          <cms:embed 'three-column-layout.html'/>
       </cms:if>


Then the two column layout for example would look like the following as a html file as a couchcms snippet in the couch/snippets folder

Code: Select all
    <!-- Page Content -->
    <div class="container">
     
     <!-- Content Row -->
      <div class="row">
         
        <div class="col-md-6 mb-6">
          <div class="card h-100">
            <div class="card-body">
              <h2 class="card-title"><cms:show two_column_layout_one_cardsoneheading/></h2>
              <p class="card-text">
                <cms:show two_column_layout_one_cardsonetext/>
              </p>
            </div>
            <div class="card-footer">
              <a href="#" class="btn btn-primary"><cms:show two_column_layout_one_cardsonebuttontext/></a>
            </div>
          </div>
        </div>
       
        <div class="col-md-6 mb-6">
          <div class="card h-100">
            <div class="card-body">
              <h2 class="card-title"><cms:show two_column_layout_one_cardstwoheading/></h2>
              <p class="card-text">
              <cms:show two_column_layout_one_cardstwotext/> 
              </p>
            </div>
            <div class="card-footer">
              <a href="#" class="btn btn-primary"><cms:show two_column_layout_one_cardstwobuttontext/></a>
            </div>
          </div>
        </div>

      </div>
      <!-- /.row -->

    </div>
    <!-- /.container -->


Then the three column layout for example would look like the following as a html file as a couchcms snippet in the couch/snippets folder

Code: Select all
    <!-- Page Content -->
    <div class="container">
     
     <!-- Content Row -->
      <div class="row">
        <div class="col-md-4 mb-4">
          <div class="card h-100">
            <div class="card-body">
              <h2 class="card-title"><cms:show three_column_layout_two_cardoneheading/></h2>
              <p class="card-text">
              <cms:show three_column_layout_two_cardonetext/>
              </p>
            </div>
            <div class="card-footer">
              <a href="#" class="btn btn-primary"><cms:show three_column_layout_two_cardonebuttontext/></a>
            </div>
          </div>
        </div>
        <!-- /.col-md-4 -->
        <div class="col-md-4 mb-4">
          <div class="card h-100">
            <div class="card-body">
              <h2 class="card-title"><cms:show three_column_layout_two_cardtwoheading/></h2>
              <p class="card-text">
              <cms:show three_column_layout_two_cardtwotext/>
              </p>
            </div>
            <div class="card-footer">
              <a href="#" class="btn btn-primary"><cms:show three_column_layout_two_cardtwobuttontext/></a>
            </div>
          </div>
        </div>
        <!-- /.col-md-4 -->
        <div class="col-md-4 mb-4">
          <div class="card h-100">
            <div class="card-body">
              <h2 class="card-title"><cms:show three_column_layout_two_cardthreeheading/></h2>
              <p class="card-text">
              <cms:show three_column_layout_two_cardthreetext/>
              </p>
            </div>
            <div class="card-footer">
              <a href="#" class="btn btn-primary"><cms:show three_column_layout_two_cardthreebuttontext/></a>
            </div>
          </div>
        </div>
        <!-- /.col-md-4 -->

      </div>
      <!-- /.row -->

    </div>
    <!-- /.container -->


Hope that helps in what your looking for
I think your solution is what I need. I've made the nested page but I don't know how to make the pages have urls like localhost.dev/privacy

My url looks like localhost.dev/nestedpage/privacy

Thank you
Israel wrote: I think your solution is what I need. I've made the nested page but I don't know how to make the pages have urls like localhost.dev/privacy

My url looks like localhost.dev/nestedpage/privacy

Thank you


To have the pages such as localhost.dev/privacy the clonable nested page needs to be the index.php page, if you use another page as the clonable nested page page such as nestedpage.php the urls would look like how you have mentioned as localhost.dev/nestedpage/privacy so use index.php as the clonable nested page
A URL like "localhost.dev/nestedpage/privacy" suggests your template name is 'nestedpage.php'.

For a template's name to be omitted from the URL, it has to have 'index' in its name
e.g. if the nested template was named index.php, the URL of a page named 'privacy' would be "localhost.dev/privacy".

Hope this helps.
Thank you!
10 posts Page 1 of 1
cron