Forum

Thread tagged as: Question

Assign Page a Category

How would I assign a page to a category? I created a set called Pages and a category called Featured pages. My goal is to have the ability to add a page, assign it as a featured page, and then output that category on my homepage. Any featured page would display there.

Does that make sense or would it be better to do this using navigation groups? I was thinking categories as I want to be able to show a description/intro text for the page.

Thank you in advance, Trevor Brandt

Trevor Brandt

Trevor Brandt 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I would use a navigation group, and add the description as a page attribute.

Drew McLellan said:

I would use a navigation group, and add the description as a page attribute.

Thanks for the quick reply. I created a navigation group called Featured pages. I made a template called featured-pages.html. Here's the code in the template:

        <div class="col-md-4 mb-4">
          <div class="card h-100">
            <div class="card-body">
              <h2 class="card-title"><perch:pages id="pageNavText" /></h2>
              <p class="card-text">ATTRIBUTE GOES HERE</p>
            </div>
            <div class="card-footer">
             <a href="<perch:pages id="pagePath" class="btn btn-primary" /><perch:pages id="pageNavText" /></a>
            </div>
          </div>
        </div>
        <!-- /.col-md-4 -->

I added a page to the Featured pages navigation group. This is the output I have to display the group:

            <?php
    perch_pages_navigation(array(
        'template'             => 'featured_pages.html',
        'navgroup'             => 'featured-pages'
    ));
?>

Nothing is displaying. Am I doing something incorrectly? Thanks in advance.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Does the navgroup have any pages in it?

Yes, I added a page to it. Also, I wasn't sure what to put in for the attribute area.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you tried with just the default template?