Many time you need to provide relative path when you are working with image, js or css files. Of course you can use hard coded (Absolute) path but it fails after changing domain name or environment. Absolute path is more useful when linking to another website. You can also build relative path using ../ but it fails when you add reference in master page.
Fortunately, SharePoint provides SPUrlExpressionBuilder and URL tokens to generate the relative url. You can use following url tokens:
Fortunately, SharePoint provides SPUrlExpressionBuilder and URL tokens to generate the relative url. You can use following url tokens:
- ~Site - Resolve to current web
- ~SiteCollection - Resolve to current site collection root