Link page id's together to display the same content in more than one place
I am looking for a way to link two or more pages (nodes) together so that by inputting content into one page, it will show up in other ones. For instance, I want to be able to input content into /about.aspx and have that content show up in /college/about.aspx or /highschool/about.aspx. Is XSLT the way to handle this?
You should have a look at the miscellaneous redirects/aliases that Umbraco provides out of the box, e.g. you could use a property called umbracoInternalRedirectId - you would set it on /college/about/ and /highschool/about/, both pointing to /about/ and Umbraco will take care of the rest.
If you'd rather not have to create the extra pages, then you can use umbracoUrlAlias on the /about/ page, which will have the same end result.
I do a similar thing for a website footer whose content the user enters on the homepage node footer property but which appears for all other pages in the site as well (all other pages are based on a different document type and template).
Basically you use the Umbraco library extenstion GetXmlNodeById in xslt to return the text entered for footer on the homepage.
This of course should have an associated macro that you can use to render the same content on the other pages without having to define the same property (and reenter the text) in the other documnt types.
This allows me to reuse the macro without having to have a different macro for every page. I thought that the HTML markup was being printed as text because the macro was calling the source node into a rich text editor. So I changed the data type to a text string, hoping that it would read the HTML rather than print it as text, but that didn't work.
Is there a way to get the recieving page to read the markup? Or do I have to put the macro into a template?
Update, I tried to fetch the node's content by using the Macro Container data type, but it is having the same result (HTML markup is printing as text rather than being parsed).
I created a tab into which I inserted the macro container. In my template I accessed the page field,
Then in the content area I went into the tab I created, and picked my node using the contentpicker in the macro. When the page loads, all the HTML markup comes mixed with the content:
Because the contents of the RichText editor is stored as plain text in the XML (or technically more correct, a "CDATA Section") - the XSLT processor can't process it as regular XML (big minus) - but the disable-output-escaping flag tells the processor to just output it "as is".
Link page id's together to display the same content in more than one place
I am looking for a way to link two or more pages (nodes) together so that by inputting content into one page, it will show up in other ones. For instance, I want to be able to input content into /about.aspx and have that content show up in /college/about.aspx or /highschool/about.aspx. Is XSLT the way to handle this?
Hi Luke,
You should have a look at the miscellaneous redirects/aliases that Umbraco provides out of the box, e.g. you could use a property called umbracoInternalRedirectId - you would set it on /college/about/ and /highschool/about/, both pointing to /about/ and Umbraco will take care of the rest.
If you'd rather not have to create the extra pages, then you can use umbracoUrlAlias on the /about/ page, which will have the same end result.
/Chriztian
I do a similar thing for a website footer whose content the user enters on the homepage node footer property but which appears for all other pages in the site as well (all other pages are based on a different document type and template).
Basically you use the Umbraco library extenstion GetXmlNodeById in xslt to return the text entered for footer on the homepage.
This of course should have an associated macro that you can use to render the same content on the other pages without having to define the same property (and reenter the text) in the other documnt types.
Good luck
Jules
This is working, but it is importing all the HTML markup along with the content.
I am inserting the macro into the Rich Text editor, and I have the XSLT file pulling info based on a source retrieval (see below):
<xsl:variable name="source" select="/macro/source"/>
<xsl:variable name="homeNode" select="umbraco.library:GetXmlNodeById($source)"/>
<xsl:value-of select="$homeNode/pageContent"/>
This allows me to reuse the macro without having to have a different macro for every page. I thought that the HTML markup was being printed as text because the macro was calling the source node into a rich text editor. So I changed the data type to a text string, hoping that it would read the HTML rather than print it as text, but that didn't work.
Is there a way to get the recieving page to read the markup? Or do I have to put the macro into a template?
Thanks.
Update, I tried to fetch the node's content by using the Macro Container data type, but it is having the same result (HTML markup is printing as text rather than being parsed).
I created a tab into which I inserted the macro container. In my template I accessed the page field,
<umbraco:Item field="sourcePage" runat="server" />
Then in the content area I went into the tab I created, and picked my node using the contentpicker in the macro. When the page loads, all the HTML markup comes mixed with the content:
Am I missing something?
Hi Luke,
Back to the macro from your previous post - you just need to set a flag in the value-of instruction:
Because the contents of the RichText editor is stored as plain text in the XML (or technically more correct, a "CDATA Section") - the XSLT processor can't process it as regular XML (big minus) - but the disable-output-escaping flag tells the processor to just output it "as is".
/Chriztian
Thank-you, Chriztian! That was the piece I was missing. This works beautifully now!
is working on a reply...