I'm still learning Sitecore at the moment, and what I want to do is get the urls for several pages in a Sitecore site and use them to set some URLs in JavaScript.
This the JavaScript I have set up:
<script>
var page_data = {
residentialUrl: '[Sitecore page link]',
airportsUrl: '[Sitecore page link]',
universitiesUrl: '[Sitecore page link]',
officesUrl: '[Sitecore page link]',
tunnelsUrl: '[Sitecore page link]',
hospitalsUrl: '[Sitecore page link]',
sportsUrl: '[Sitecore page link]',
publicSafteyUrl: '[Sitecore page link]',
governmentUrl: '[Sitecore page link]'
}
</script>
It does work if you put a url inside single quotes for each url variable. But What I want is to put in the url of a Sitecore item for each url variable. I know how to get Sitecore item urls but I'm not sure how I would use them in this instance to set the url variables above? I don't want to have to hard-code the links in. I want them to be pulled from fields in Sitecore. Is there a way to do this?