Are you using the blog4umbraco package on your site? And do you just want to display links to your posts on the frontpage? And what is it that you're using jQuery for?
I know these are a lot of questions but I think we need a bit more information to be able to give you some qualified answers to help you out properly :-)
I would like to display the first two blog posts on my front page, but am having zero luck. Using some information I found on other posts, I created the following XSLT (and a macro to use it):
Can you perhaps post a screendump of your content section so I can see your structure? Have you also added a content picker property with the alias of "newsSource" to your frontpage node? If so what have you selected a node with it?
If you have selected a source you can see the XML you get returned by writing this
Then you get a dump of the actual XML you're trying to match and you can copy it into an editor to get a better overview of the structure. This makes it easier to find out how to match the desired elements and attributes.
You need to go to the settings section and find your document type for the frontpage under "document types". Click on it and go to the "Generic properties" tab.
Here you have the option to add a new property to one of the tabs of your frontpage document type, which is probably called "Blog". You can properly see a pane called "settings". Let's add the newsSource property here.
To do that you need to click the text under "Add new property" that says "click here to add a new property". Then you have som fields to fill out. The first is the name of the field that you will see in the content section when you're editing the blog, the second is the alias, which is the one used to reference the property in the XSLT. In the third field you need to choose the datatype to use. Here you should choose "Content picker". The fourth determines under, which tab you want this property to appear. Here you can choose "Settings". Leave the "Mandatory" and "Validation" fields empty and add a description of what the property is meant for if you like. It's not neccesary to do it, but a good helptext is always nice (it's shown below the property name in the content section).
Below you can see the values you should enter in the mentioned fields.
Name: News Source Alias newsSource (It's important that it has the same casing as the alias you are using in the XSLT!) Type: Content Picker Tab: Settings
Once the values are entered click the save button.
Now go to your content section and use the content picker to choose where to get the blogposts from. Save and publish. To make sure the XML cache is updated right click the "Content" node (the one on the first level) and choose the "Republish entire site" option.
Now you can play around with the XSLT.
To see if the property has any value at all you can write this: <xsl:value-of select="$currentPage/newsSource" /> - this should output a 4 digit node id. If you succeed with this you can move on using the id to get the XML of the chosen id returned. You can use the <xsl:copy-of> example from my previous post to do that.
"Now go to your content section and use the content picker to choose
where to get the blogposts from. Save and publish. To make sure the XML
cache is updated right click the "Content" node (the one on the first
level) and choose the "Republish entire site" option."
In your "Content" section in Umbraco you have a frontpage node, which you have added the content picker datatype to, right? On your frontpage node you should now be able to use the content picker to choose a source of your blogposts. If I remember correctly the posts are automatically organized into folder starting with the current year. So I guess you have a folder named "2011". With the content picker select this folder. Now hit the "Save and publish" button on the node.
Now...in the top of the "content" section there is a..."master node" called "Content" in the top of the content window. The node where you create your frontpage nodes. When you right click this, you should see an option called "Republish entire site". Click it and the XML cache is updated. This makes sure that the value you're trying to fetch with your XSLT file is present in the umbraco.config file (The XML that you're matching).
Well done! I'm very happy to hear that you got the bricks to fall in to piece.
I think that you're going to get the concepts of Umbraco quicker now.
I'm sure you have already discovered that there is much great stuff in the wiki, which can be of use to people at different levels and you surely know about this awesome forum where people are ready to help you out the minute you make a post.
If you're succesfull on convincing your boss that you guys need to base your web projects on Umbraco in the future I think you really should consider throwing some money after umbraco.tv since there is a lot of good stuff in there and the videos are thourough and a lot of subjects are covered. Umbraco looks so simple when you look at the UI...and it's! But it's also VERY powerfull and flexible...and a joy to work with once you have got used to the concepts in Umbraco.
*fingers croseed you manage to convince your boss* :-)
RSS feed of Blog posts
I am new to Umbraco. I have searched and searched without any luck:
How do I put the last few blog posts on my front page as links? I found /blog/rss.aspx, but jquery doesn't like using that page as its source.
Any help would be much appreciated.
Hi Mark and welcome to our :-)
What is it you're exactly trying to achieve?
Are you using the blog4umbraco package on your site? And do you just want to display links to your posts on the frontpage? And what is it that you're using jQuery for?
I know these are a lot of questions but I think we need a bit more information to be able to give you some qualified answers to help you out properly :-)
/Jan
Hello, and thank you!
Yes, I have installed BlogForUmbraco 2.0.26.
I would like to display the first two blog posts on my front page, but am having zero luck. Using some information I found on other posts, I created the following XSLT (and a macro to use it):
Then, I consume it using the following aspx macro:
It does nothing. (ShowLastFewBlogPosts is the alias I assigned to my macro in the admin interface).
Am I doing something wrong?
Hi Mark
What version of Umbraco are you running? If it's 4.5.x that's why the above XSLT does not work, since that's trying to match the old XML schema.
Besides some of your XSLT looks a bit weird...I'm guessing you have been playing around a bit, huh? (It's the only way to learn, been there!)
If you're using umbraco 4.5.x then give the below a try...it's done by the top of my head but I think it really should be working.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary"
exclude-result-prefixes="msxml
umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes
Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings
Exslt.ExsltSets tagsLib BlogLibrary ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="linkSource" select="$currentPage/newsSource" />
<xsl:variable name="newsSource" select="umbraco.library:GetXmlNodeById($linkSource)" />
<xsl:template match="/">
<xsl:for-each select="$newsSource//BlogPost">
<xsl:sort select="@sortOrder" order="descending" />
<xsl:if test="position()<= 2">
<div class="item">
<h2>
<xsl:value-of select="@nodeName" />
</h2>
<xsl:value-of select="bodyText" disable-output-escaping="yes"/>
<div class="date">
<p>
<xsl:value-of select="umbraco.library:FormatDateTime(@createDate,'d MMM yyyy')" />
</p>
</div>
<div class="more"><a href="{umbraco.library:NiceUrl(@id)}">More ></a></div>
<div class="clear"> </div>
</div>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Hope this helps.
/Jan
I really appreciate your help with this!
You are correct that I have been messing around quite a bit.
As you suggested, I am running 4.5.2. I get the same results while running your XSLT though :(
Hi Mark
Can you perhaps post a screendump of your content section so I can see your structure? Have you also added a content picker property with the alias of "newsSource" to your frontpage node? If so what have you selected a node with it?
If you have selected a source you can see the XML you get returned by writing this
<textarea>
<xsl:copy-of select="$newsSource" />
</textarea>
Then you get a dump of the actual XML you're trying to match and you can copy it into an editor to get a better overview of the structure. This makes it easier to find out how to match the desired elements and attributes.
Hope this helps.
/Jan
Jan,
I have not added a content picker property with the alias of newsSource to my front page. That sounds like it could be my problem!
...could you advise me on how to do that?
Thanks,
Mark
Hi Mark
Off course...
You need to go to the settings section and find your document type for the frontpage under "document types". Click on it and go to the "Generic properties" tab.
Here you have the option to add a new property to one of the tabs of your frontpage document type, which is probably called "Blog". You can properly see a pane called "settings". Let's add the newsSource property here.
To do that you need to click the text under "Add new property" that says "click here to add a new property". Then you have som fields to fill out. The first is the name of the field that you will see in the content section when you're editing the blog, the second is the alias, which is the one used to reference the property in the XSLT. In the third field you need to choose the datatype to use. Here you should choose "Content picker". The fourth determines under, which tab you want this property to appear. Here you can choose "Settings". Leave the "Mandatory" and "Validation" fields empty and add a description of what the property is meant for if you like. It's not neccesary to do it, but a good helptext is always nice (it's shown below the property name in the content section).
Below you can see the values you should enter in the mentioned fields.
Name: News Source
Alias newsSource (It's important that it has the same casing as the alias you are using in the XSLT!)
Type: Content Picker
Tab: Settings
Once the values are entered click the save button.
Now go to your content section and use the content picker to choose where to get the blogposts from. Save and publish. To make sure the XML cache is updated right click the "Content" node (the one on the first level) and choose the "Republish entire site" option.
Now you can play around with the XSLT.
To see if the property has any value at all you can write this: <xsl:value-of select="$currentPage/newsSource" /> - this should output a 4 digit node id. If you succeed with this you can move on using the id to get the XML of the chosen id returned. You can use the <xsl:copy-of> example from my previous post to do that.
I hope this helps.
Happy umbracoing :-)
/Jan
I did everything but this:
"Now go to your content section and use the content picker to choose where to get the blogposts from. Save and publish. To make sure the XML cache is updated right click the "Content" node (the one on the first level) and choose the "Republish entire site" option."
I am not sure how to do this.
Hi Mark
You did not do the above step at all or?
Let's brake it down.
In your "Content" section in Umbraco you have a frontpage node, which you have added the content picker datatype to, right? On your frontpage node you should now be able to use the content picker to choose a source of your blogposts. If I remember correctly the posts are automatically organized into folder starting with the current year. So I guess you have a folder named "2011". With the content picker select this folder. Now hit the "Save and publish" button on the node.
Now...in the top of the "content" section there is a..."master node" called "Content" in the top of the content window. The node where you create your frontpage nodes. When you right click this, you should see an option called "Republish entire site". Click it and the XML cache is updated. This makes sure that the value you're trying to fetch with your XSLT file is present in the umbraco.config file (The XML that you're matching).
Hope this makes better sense to you :-)
/Jan
We did it!! Thank you for your help: I am not sure I would ever figured it out were it not for your guidance.
I work for a web design shop and would like to make Umbraco our CMS of choice. I just have to get past this noob stage and I should be set!
Hi Mark
Well done! I'm very happy to hear that you got the bricks to fall in to piece.
I think that you're going to get the concepts of Umbraco quicker now.
I'm sure you have already discovered that there is much great stuff in the wiki, which can be of use to people at different levels and you surely know about this awesome forum where people are ready to help you out the minute you make a post.
If you're succesfull on convincing your boss that you guys need to base your web projects on Umbraco in the future I think you really should consider throwing some money after umbraco.tv since there is a lot of good stuff in there and the videos are thourough and a lot of subjects are covered. Umbraco looks so simple when you look at the UI...and it's! But it's also VERY powerfull and flexible...and a joy to work with once you have got used to the concepts in Umbraco.
*fingers croseed you manage to convince your boss* :-)
/Jan
is working on a reply...