Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I created a macro for rendering an RSS feed.
I created a partial view in MacroPartials folder and there I put a cshtml file.
MacroPartials
After that, I registered that view in Developer->Macro (in Umbraco CMS) and I add one called Feed and specified the relative url to cshtml file.
Developer->Macro
Feed
FeedMacro.cshtml
// logic here to construct RSS feed
I created another view, in Views folder called Feed.cshtml and I wrote:
Views
Feed.cshtml
@inherits UmbracoTemplatePage @{ Layout = null; Response.ContentType = "application/xml"; } @Umbraco.RenderMacro( "Feed" ) // which is registered in Developer section
I want to access that feed like:
http://blabla.com/feed
What should I do ? What I missed ?
Thanks
HI Mihail,
Is this Feed.cshtml created as a template in Umbraco. Than you would be able to call with the url that you specified.
Or with http://blabla.com/feed?altTemplate=feed
Dave
I assume that you've created a document type using the Feed.cshtml as it's view? And that you added a page of this document type to the content tree and named it "Feed"?
What message do you get when accessing http://blabla.com/feed ? 404?
Why do you wan't the logic in a macro instead of the view?
Creating the template did the trick. Thanks
Hi Mihail,
Nice to see you got it working. Don't forget to mark the post with a solution so others can find it quickly as well.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to access a macro view in url
Hi,
I created a macro for rendering an RSS feed.
I created a partial view in
MacroPartials
folder and there I put a cshtml file.After that, I registered that view in
Developer->Macro
(in Umbraco CMS) and I add one calledFeed
and specified the relative url to cshtml file.FeedMacro.cshtml
I created another view, in
Views
folder calledFeed.cshtml
and I wrote:I want to access that feed like:
http://blabla.com/feed
What should I do ? What I missed ?
Thanks
HI Mihail,
Is this Feed.cshtml created as a template in Umbraco. Than you would be able to call with the url that you specified.
Or with http://blabla.com/feed?altTemplate=feed
Dave
I assume that you've created a document type using the Feed.cshtml as it's view? And that you added a page of this document type to the content tree and named it "Feed"?
What message do you get when accessing http://blabla.com/feed ? 404?
Why do you wan't the logic in a macro instead of the view?
Creating the template did the trick. Thanks
Hi Mihail,
Nice to see you got it working. Don't forget to mark the post with a solution so others can find it quickly as well.
Dave
is working on a reply...