In multisite, get context name of current resource

I have a multisite and I can see all the contexts on the left hand tree. Is there a way I can get the context key or name of a specific resource?

-web context

  • page 1
  • page 2
    -web2 context
  • page 3
  • page 4

[[*context_key]] will get the key for the current resources’ context.

To get the name of the current context you’d need a snippet:

<?php
return $modx->context->get('name');