What is the best way to get the full path to the home page?
This only works if the ID of the home page is 1:
$HomeLink = DataObject::get_by_id("SiteTree", 1)->Link();
But if I make a different page the home page it does not work.
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
What is the best way to get the full path to the home page?
This only works if the ID of the home page is 1:
$HomeLink = DataObject::get_by_id("SiteTree", 1)->Link();
But if I make a different page the home page it does not work.
$HomeLink = Director::absoluteBaseURL();
Thanks!