I want ot create a list of faqs each item should have a title and a bit of copy. I jsut want to list them out with a bit of Razor and they should not have their own page (helpfultips.aspx). I have no idea how to do this in Umbraco as I am coming from a drupal background.
In a website I am working on right now I have done it like this:
Created a Document type called "Question Group" (containing "title" and "intro") and another one called "Question" (caontaining "question" and "answer"). They don't inherit from anything. (Ofcause I allow the "Question Group" to be a child node of my "Frontpage" document type)
Then I create my FAQ in the content tree. The Question Group allows me to group the questions in a logic that fits my website. E.g. I can relate a product category to a specific group of questions. You can just skib that if you don't need it.
In Razor I've made the following code:
@{ var faq = Library.NodeById(1172); <h3>@faq.faqGroupTitle</h3> foreach(var item in faq.Children.Where("Visible")) { <p><strong>@item.faqQuestion</strong></p> @item.faqAnswer } }
Now just insert the macro on the page that should view the FAQ and your done.
Not that I know of. But since you don't link to the node (suposeing you use the code I posted) users will never get to it. So it won't be a problem. The link is only presented in the backend of Umbraco.
Creating a list of faqs
Hi,
I want ot create a list of faqs each item should have a title and a bit of copy. I jsut want to list them out with a bit of Razor and they should not have their own page (helpfultips.aspx). I have no idea how to do this in Umbraco as I am coming from a drupal background.
In a website I am working on right now I have done it like this:
Now just insert the macro on the page that should view the FAQ and your done.
Hope it gives you an idea...
am working on it now, it looks good!
Great. Don't hesitate to let me know if you have any troubles with it.
Thanks, the only thing is I do not need the link to document
Anyway I can loose this or at least hide it?
Thanks again.
Not that I know of. But since you don't link to the node (suposeing you use the code I posted) users will never get to it. So it won't be a problem. The link is only presented in the backend of Umbraco.
is working on a reply...