javascript - Umbraco Macro Referenced Root But is now Broken After Relocation -


i followed following steps in umbraco add folder structure in content nodes.

step 1

create new document type called content folder.

go settings > document types > click on 3 dots > create. give name content folder. icon select folder icon add new property redirect alias umbracoredirect type content picker save changes built-in property umbracoredirect used redirect 1 node using id. each folder set property first child page.

step 2

allow child node types in folder.

go structure tab of content folder property check child types want allow under folder save changes

step 3

allow folder under root home node.

go structure tab of home root property check contentfoldertype allow child save changes

step 4

add folder structure , add pages.

go content add new folder under root node of type content folder give name hq add new page called that's allowed under folder in hq set redirect property first page folders , pages save changes , publish

which worked had following macro in page displayed children of node in. since placed these in root have moved these in subfolder lists 1 level higher should (because current node 1 level lower.

in structure below have 2 separate menus 1 appears on whether on chapter or section page within given chapter shows list of sections in chapter. chapter 1 show 1.1 , 1.2. second menu goes on section , story pages in same chapter , displays stories in section if on section 1.1 page show me stories 1.1.1, 1.1.2, , 1.1.3

my structure      root     -team 1 (folders)     --level 1 (chapters)     ---level 1.1 (sections)     ----level 1.1.1 (stories)     ----level 1.1.2 (stories)     ----level 1.1.3 (stories)     ---level 1.2 (sections)     ----level 1.2.1 (stories)     ----level 1.2.2 (stories)     ----level 1.2.3 (stories)     --level 2     ---level 2.1     ----level 2.1.1     --level 3     --level 4     ---level 4.1     ----level 4.1.1     -team 2 folder     -team 3 folder 
<umbraco:macro  runat="server" language="cshtml"> @inherits umbraco.macroengines.dynamicnodecontext    @*   macro display child pages below root page of standard website.   highlights current active page/section in navigation   css class "current".    *@    @{    @* root of website *@   var root = model.ancestororself(1);   }   <ul>     <li>chapter<br>       sections       <ul>         @foreach (var page in root.children.where("visible"))         {         <li class="@page.isancestororself(model, "current", "")"> <a href="@page.url">@page.name</a> </li>         }       </ul>     </li>   </ul> </umbraco:macro> 

i know how can macro working again , refrencing right nodes.

edit

i have code show second level of nodes

<?xml version="1.0" encoding="utf-8"?> <!doctype xsl:stylesheet [ <!entity nbsp "&#x00a0;"> ]> <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:examine="urn:examine"      exclude-result-prefixes="msxml umbraco.library examine ">  <xsl:output method="xml" omit-xml-declaration="yes" />  <xsl:param name="currentpage"/>  <!-- input documenttype want here --> <xsl:variable name="level" select="2"/>         <xsl:variable name="startnode" select="$currentpage/ancestor-or-self::*[@level = $level]" /> <xsl:variable name="nodestoshow" select="$startnode/*[@isdoc][not(umbraconavihide = 1)]" />  <xsl:template match="/">  <!-- fun starts here --> <xsl:if test="$nodestoshow">     <img src="/media/1133/actheader2.png" alt="activities in section" class="acttitle" /> </xsl:if>     <ul> <xsl:for-each select="$currentpage/ancestor-or-self::* [@level=$level]/* [@isdoc , string(umbraconavihide) != '1']"> <li>    <xsl:attribute name="class">         <xsl:if test="contains(activityextras,'video')">video</xsl:if>         <xsl:if test="contains(activityextras,'scripted')">scripted</xsl:if>         </xsl:attribute>     <a href="{umbraco.library:niceurl(@id)}">       <xsl:value-of select="@nodename" />    </a> </li> </xsl:for-each> </ul>  </xsl:template>  </xsl:stylesheet> 

the part of code here:

var root = model.ancestororself(1); 

gets page @ level 1, homepage. if folders @ second level now, should able change to:

var root = model.ancestororself(2); 

that should folder, long you're underneath folder. if you're have nested folders, you'll need make further changes.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -