isPublic()
Check that a page is public
Params:
-
page {11ty page object}
src/filters/pages.js
isPublic()
Check that a page is public
page
{11ty page object}
isCurrent()
Check that the page does not have an end date
page
{11ty page object}
addCallToAction()
Check if a page is a Work or Services index or detail page
(under /work/ or /services/ URL).
pageURL
{url}
URL of page to test
getCurrent()
Filter to pages that do not have an end date
collection
{array}
containing 11ty page objects
getPublic()
Return only the public pages from a collection
collection
{array}
containing 11ty page objects
hasData()
Return true if a an object (often a page) has particular data
obj
{object}
The object to search for data
keys
{string}
Any nested data attributes to get
value
{any}
Only approve pages where the desired attributes have a given value
exact
{boolean}
Force an exact match, rather than inclusion
withData()
Return pages with particular data
collection
{array}
containing 11ty page objects
keys
{string}
Any nested data attributes to get
value
{any}
Only get pages where the desired attributes have this value
exact
{boolean}
Force an exact match, rather than inclusion
removePage()
Remove any one page from a collection (especially for removing tag index pages from their own post list)
collection
{array}
containing 11ty page objects
url
{url}
URL of the page to remove
isType()
Filters collection by a given tag,
expected to be one of several post “types”
(types are defined in the taxonomy.yaml data file)
collection
{array}
containing 11ty page objects
type
{type}
post type to filter by
isPublicType()
Filters collection and removes any pages
that are of a non-public type.
(types are defined in the taxonomy.yaml data file)
collection
{array}
containing 11ty page objects
isHome()
Filters collection by home data.
Posts are included if home is not false.
If limit is set, only the first limit posts are included,
plus any posts with home set to pin or pinned.
collection
{array}
containing 11ty page objects
limit
{number}
getData()
Return combined data from a collection
collection
{array}
often an array of 11ty pages, but can be an array of any objects
keys
{string | false}
use dot-notation (data.press) for nested keys,
or false to filter without digging into nested data
test
{string | object}
= undefined
filter the resulting collection
{# all events #}
{{ collections.all | getData('data.events') }}
{# all events with a venue #}
{{ collections.all | getData('data.events', 'venue') }}
{# all events with a venue of 'Smashing Conf' #}
{{ collections.all | getData('data.events', {'venue': 'Smashing Conf'}) }}
findData()
The same as getData, but only returns the first match in the collection
collection
{array}
often an array of 11ty pages, but can be an array of any objects
keys
{string}
use dot-notation (data.press) for nested keys
test
{string | object}
= undefined
filter the resulting collection
{{ collections.all | findData('data.press', {'slug': 'handoff'}) }}
getPage()
Return a single page by url, or return data from inside that page
collection
{array}
often an array of 11ty pages, but can be an array of any objects
url
{url}
The url of the desired page
keys
{string}
use dot-notation (data.press) for nested keys
test
{string | object}
= undefined
filter the resulting collection
{{ collections.all | getPage('/work/timedesigner/', 'data.press') }}
findPage()
Find the first page with any particular data
collection
{array}
often an array of 11ty pages, but can be an array of any objects
keys
{string}
use dot-notation (data.press) for nested keys
value
{any}
Only find pages where the desired keys have a given value
{{ collections.all | findPage('data.info_slug', 'alert') }}
pageYears()
Add sort and year keys to the page object,
based on the latest date available (date or end),
optionally including dates from events
collection
{array}
containing 11ty page objects
eventSort()
Sort pages based on either the page date, or the most recently past event date.
collection
{array}
containing 11ty page objects
byYear()
Runs a collection through pageYears,
and then groups them by the resulting year value
collection
{array}
containing 11ty page objects