Utilities Reference
This reference page documents utility functions provided by DeWP for working with your WordPress content in Astro.
Content utilities
Content utilities help simplify common operations with your WordPress content.
These utilities can be imported from the dewp/content-utils
module.
getSiteSettings()
Type: () => Promise<CollectionEntry<'site-settings'>>
Get settings from the site-settings
content collection.
Includes name
(the site title), description
, and a couple of other handy bits of metadata.
resolvePageSlug(page)
Type: (page: CollectionEntry<'pages'>) => Promise<string>
If pages have parents, WordPress prepends parent slugs to the page slug.
For example, given a lion
page with a big-cats
parent, the page would be served at big-cats/lion
.
The resolvePageSlug()
function resolves parent pages to construct a multi-segment path in the same way.