I am trying to create a news section on my frontpage (Home) umbraco site.
My idea is to keep the news content apart from the site content in a folder like this:
Home
Page2
Page3
News
News item 1
News item 2
But how can I get the news content into my (home) page, when it's not in the same folder?
Please help.
If you're using XSLT then you'd do this:
<xsl:for-each select="$currentPage/ancestor-or-self::root/News/NewsItem">
<!-- do whatever here -->
</xsl:for-each>
If you're doing Razor syntax, then use:
#foreach (var newsitem in Library.NodeById(-1).Descendants("News").ChildrenAsList) {
// Your processing/rendering code in here
}
Related
I have a page listing filtered news upon category filter . So I added news category list and news list filtered modules in one page. The news list will show the news with selected category in the category list. The url generated for the news list filtered is
www.mysite/portFolio/categorie/cat
When I change the url to www.mysite/portFolio/categorie/cat. (with a dot) the page is showing 404 . But the page contain some unwanted dumps in header like ...... itemscope itemtype="http://schema.org/WebPage" data-frontend-helper="......">
I think the issue is coming from news_categories extension in which a 404 page generated in vendor/codefog/contao-news_categories/models/NewsModel.php (line no 98,99). My contao version is 4.5.8.
How to solve this issue?
I'm setting up Umbraco 7.7 for the first time and creating the document types and templates for a page that displays the people that work at our organization (includes their names, photos, and bios).
How do I configure it such that the content manager can add another "person"—effectively a cluster of divs with user-editable images and text—without having to manually add another "person" to the template? Using Partial Views seems like part of the solution, but I'm unclear on how to fit it all together.
My template (simplified) currently looks something to the effect of:
#inherits Umbraco.Web.Mvc.UmbracoTemplatePage
#{
Layout = null;
}
<!doctype html>
<html>
<body>
<div class="person-bio">
<img src="/media/person-01-photo.jpg">
<p>#Umbraco.Field("person-01-name")</p>
<p>#Umbraco.Field("person-01-title")</p>
<p>#Umbraco.Field("person-01-bio")</p>
</div>
<div class="person-bio">
<img src="/media/person-02-photo.jpg">
<p>#Umbraco.Field("person-02-name")</p>
<p>#Umbraco.Field("person-02-title")</p>
<p>#Umbraco.Field("person-02-bio")</p>
</div>
<div class="person-bio">
<img src="/media/person-03-photo.jpg">
<p>#Umbraco.Field("person-03-name")</p>
<p>#Umbraco.Field("person-03-title")</p>
<p>#Umbraco.Field("person-03-bio")</p>
</div>
<!-- etc., etc. -->
</body>
</html>
Thank you! Any help would be much appreciated.
You'll probably will want to use the Nested Content control for this. It allows you to add a list of entities (in your case persons) on a document
More documentation about the nested content control can be found here: https://our.umbraco.com/documentation/getting-started/backoffice/Property-Editors/Built-in-Property-Editors/Nested-Content
So from my understanding you don't need a partial view. If it's that simple and you want to output only the div I see you're repeating, then loop it:
#foreach (var person in whateverYourCollectionIs) {
<div class="person-bio">
<img src="/media/person-01-photo.jpg">
<p>#person.GetPropertyValue<string>("pseudoNameFieldAlias")</p>
<p>#person.GetPropertyValue<string>("pseudoTitleFieldAlias")</p>
<p>#person.GetPropertyValue<string>("pseudoBioFieldAlias")</p>
</div>
}
That loop will create the exact same html for each person, but with the appropriate names, Titles, Bio etc. This is not the actual code you get to use but it hopefully leads you to the correct direction.
This is the documentation that will help
I'm currently trying to make a website in ASP.NET Core MVC. In my layout page, I'm making a navigation bar to access all of the actions that can be reached through my controllers. I am however unable to create useful links.
<ul>
<li>Home</li>
<li>Index</li>
</ul>
My problem with this is that I still need the controller before the links and if I put the controller in front of the action like this
<ul>
<li>Home</li>
<li>What We've Done</li>
</ul>
When I click on one link and then the other, the link will end up being "myurl/home/home/page".
How can I create the link to only link to the exact page I want to?
You should use the anchor tag helper to build the markup for the link
<a asp-action="index" asp-controller="home">Home</a>
This will generate the correct relative path to the index action as the href property value of the anchor tag.
I am navigating to a page with bookmark - http://www.makemeok.com/ncr/palam-colony-hospitals/singhal-hospital-jabfc#description
The page is templated using ASP.NET MVC Razor engine.
The bookmark - description exists on the page. But, the page does not scroll down to the bookmark on document load. Any reasons why the bookmark is not working?
<a id="description" name="description"></a>
I checked your page, that situated on link.
You have 2 a tags with id and name with value description.
That's why it's not working. Just change one of them to
<a id="description2" name="description2">...</a>
And everything will work.
I need to support a site made using umbraco. am a total newbie in umbraco. let me explain my scenario. I have left have menu which is used to navigate to different pages. Now i need to change one menu item to navigate to a different page. How is this posible?
It is using macro to create the main menu. The master page shows it has macro DisplayMainMenu. This macro uses XSLT file DisplayMainMenu. Am attaching the xslt code herewith:
<div id="main_navigation" class="jqueryslidemenu unitPng">
<ul>
<li>Home</li>
<xsl:for-each select="$pagesNodeSet">
<xsl:sort select="./#sortOrder" data-type="text" order="ascending"/>
<li>
<xsl:value-of select="./title"/>
<xsl:if test="count(./*[#isDoc and string(umbracoNaviHide) != '1' and string(includeInMainNavigation) = '1']) > 0">
<ul class="sub-menu">
<xsl:for-each select="./*[#isDoc and string(umbracoNaviHide) != '1' and string(includeInMainNavigation) = '1']">
<xsl:sort select="./#sortOrder" data-type="text" order="ascending"/>
<li><xsl:value-of select="./title"/></li>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</div>
Some code part couldnot be included due to some issues with formatting.
Your xslt is dynamically creating the menu based on your site layout as defined in the content section of the umbraco dashboard. Therefore you can't "change a menu item to point to a different page" as such. What you can do is change you site structure to reflect what you want by adding new pages, moving existing pages or removing unwanted pages.
If you want to add a static page link you can do this by adding it to your xslt above (in the same way the 'Home' link has been added) but you will need to ensure that is sits outside the xslt:for-each loop unless you want to get into some complex xslt coding.
Essentially, what the above code is doing is creating an unorderd list with the first list item statically added for the home page. It is then looping each of the child pages and adding a link. Then for each child page ,if it has visible child pages (by ensuring they are not supposed to be hidden and should be included in the main navigation using their umbracoNaviHide and includeInMainNavigation properties), it is looping over each of them and displaying a link.