Collections

How the pages are organized.

Page collections

On the Troop 370 website, the pages organized into collections. The collections are as follows: About, Information, Events, Members, Photos, Contact, Payments, and Store.

To place a page into a collection , pages should be saved in the appropriate folder. See below for the folder structure with each collection

repository: troop370
    /_collections
        /_about
        /_contact
        /_events
        /information
        /_members
        /_payments
        /_photos
        /_store
circle-exclamation
circle-info

All pages should be placed in a collection in order to keep the file structure organized

Where are collections defined?

Collections are defined in _config.yml

For each collection,outputmust be set to true in order for the pages to generated.

Setting permalink allows you to control the generated file path for the pages in that collection. For example, permalink: /:path.html sets the the generated pages on the about collection to be at troop370atlanta.org/file-name.html, and permalink: /members/:path.html sets the the generated pages on the members collection to be at troop370atlanta.org/members/file-name.html.

Permalinks can also be set to generate pages in the same directory for multiple collections.

circle-exclamation

Collection pages in page navigation

Collections can be added to the page navigation in _layouts/default.html. If there is more than one page visible in the collection, the collection will automatically appear as a dropdown.

Top navigation

Navigation items for a collection can be added to the top navigation using _includes/topnav-item.html.

With the topnav-item include, the collectionattribute value should be the name of the collection as defined in _config.yml, and the collection-label attribute should be the name of the collection that is displayed in the navigation. Additionally, and optional collection-label-small attribute value can be text that should be hidden from the navigation when the browser width is smaller.

Side navigation

Navigation items for a collection can be added to the top navigation using _includes/sidenav-item.html.

With the topnav-item include, the collectionattribute value should be the name of the collection as defined in _config.yml, and the collection-label attribute should be the name of the collection that is displayed in the navigation.

Hiding pages within collections

Sometime pages that are in collections should not be displayed in the top or side navigation. If this is the case, in the page's front matter, add menu: hide.

Last updated

Was this helpful?