Creating a page list of links

  • I am creating a list of sub pages, on a category page, with title link (using _page) and description (don’t want to use the Blog addon) and have run up against two issues I cannot solve.

    1. I wish to add some page text under the h2 heading and would like to use the SEO description to do this - rather than content from the page - but cannot work out how to get the description data into the right place in the output.

    2. The pages list also includes the index.php page which is the category page I am showing this list on - I'd rather not have it on the page but cannot work out a way to not add it.


    Code I have so far:

    Code
    1. perch_content_custom(‘Page Heading’, [
    2. ‘page’ => ‘/articles/*’,
    3. ‘template’=>‘gs.list.articles.html’,
    4. ‘sort’=>‘_id’,
    5. ‘sort-order’=>‘ASC’
    6. ]);

    I can't get me head around how to add the description data from perch_page_attribute('description); and pointers please?




    Here is the gs.list.articles.html template:

    Code
    1. <h2><a href="<perch:content id="_page" replace=".php|">"><perch:content id="PageHeading" /></a></h2> <perch:content id="description" /> <p><a href="<perch:content id="_page" replace=".php|">">Read more about <perch:content id="PageHeading" /></a>.</p>

    As you can see I am picking up the Page heading from all pages under /articles/ but this also picks up index.php - anyway to not pick this up?

    Thank you.

  • drewm

    Approved the thread.
  • Result!

    The perch_pages_navigation was the perfect way to do this - not sure why I had not thought of it myself.


    Here is what i did (this is mainly for myself when i search for this again in the future...)


    Code
    1. perch_pages_navigation(array( 'from-path' => '*', 'levels' => 1, 'hide-extensions' => true, 'hide-default-doc' => true, 'template' => 'articles.list.html', 'use-attributes' => true, ));

    and the articles.list.html template that goes in /templates/navigation

    Code
    1. <perch:before><div class="container"> <h2>The articles</h2></perch:before> <h3><a href="<perch:pages id="pagePath">"><perch:pages id="pageNavText"></a></h3> <perch:pages id="description" /><perch:after></div></perch:after>

    Thanks for pointing me in the right direction Drew.

  • We've found the Navigation feature extremely useful in automatically creating Lists for our content. When we examine our user behaviour in various Analytics we see many users going to our cross-reference lists rather than using the Search option we provide. We've currently got 34 individual Cross Reference Lists driven off a 'Master' reference list


    http://aircrewremembered.com/lists-to-explore.html


    As a page is created it is assigned one or more Navigation Group(s) by the Editor and Perch then adds it to the correct Cross Reference List(s) automatically. It's a thing of beauty for a site with many hundreds of pages.