Forum
Full Site URL in Templates?
I'm wondering how to dynamically get the full site URL in a template, including domain. I found this in the Docs - perch_page_url But that is a page function. I suppose I could pass it as a variable into a template, but wondering if there is already a template function for that?
In my current case I am working with a perch blog and trying to set up social share buttons. Many thanks!
Does this information about adding Facebook like buttons help?
https://solutions.grabaperch.com/integrations/adding-facebook-like-buttons
Hmm I don't think it does. I'm not using "like" buttons. I'm just looking the easiest way to output the domain that the site is on. I don't want to have to hard-code
https://myexample.com
and have to change those instances when I migrate from local to staging to live.Does that make sense?
You can use
<perch:setting id="siteURL" />
to access the value of the site URL option in Settings.It seems
<perch:setting id="siteURL" />
only outputs "/
"What value have you set it to?
Ah, I see. it is set in the perch settings. For some reason I thought it would gather it another way. Don't ask.
Now it is working!