Access to Site and Page data in Elements API

I was just looking through the Elements Language Docs and noticed there was no mention about what data from the site or current page was exposed to custom elements via the API?

For instance, I’ve been considering building a site nav that visually highlights the current page/section (ie. /about, /articles/*, etc), but I currently can’t find anyway to ascertain which page (or path) the component is being used on. Essentially I’d like to be able to this:

  • Home
  • About <!-- you are here -->
  • News
  • Contact

And not just this,

  • Home
  • About
  • News
  • Contact

In order to be able to better indicate to users where they are in the site.
This would also be essential for creating any sort of breadcrumb navigation within a site.

Yup, you can do that! Here’s a sample project I’ve just put together that shows how to do it in a custom component.

1 Like

Thanks @Dan! Are the available project and page properties documented anywhere?

Also, can you update the link for the sample file as it currently points to Cleanshot.

Sorry, project link updated.

Re: Page Properties; take a look at the doc below. If there’s anything else you need just let me know!

Sorry @Dan, getting an error on the project link.

Sorry, try this one: elementsapp://downloadDocument/ZStlVDlr4kHt

1 Like