I’m modifying a theme and wondering if there is a way to get the slug of the current page from within a block (specifically in my case the item showcase, but I assume it would be similar for any block). Anything else that would be unique to a particular page, like an id, would work too. I can’t seem to find anything within the documentation. Thank you!
You can get the page representation with
$block->page(), and from that page object you can get the page’s ID, its slug, its title, and so on.
$block->page()->slug() gave me exactly what I needed.