Get sites/<sitename> variable in SharePoint framework extension

Occasional Contributor
How can I get the site name variable inside a sharepoint extension using sharepoint framework? Need to get the name of the site where the extension is deployed.

Any help is appreciated. Thanks!
3 Replies

One way is to use the PageContext object as described in the following article:


AFAIK the context object is also available in an Extension. The property pageContext.web.title contains the name of the site.


PnP-JS-Core also provides easy access to a lot of functionality and properties of SharePoint objects, have a look at it here:



How would I go about add the absoluteURL in a .scss file like so:


background: url("$") center center no-repeat


Thanks !