Displaying the level X ancestor

I want to use my template to display the level 1 ancestor of a page, regardless of the level the page is at in the tree.


I've hit on one method, which is to use the settings.. attribute to apply a "hide" class (defined as display:none) to anything in a menu that is not in the hierarchy but this still produces a lot of html that I don't need (the level 1 siblings of the ancestor asset).


    		
    			
    
    			
    			
    			
    
    			
    				

">



produces the following code

    

Sibling1

<h2 class="hide">
		Sibling2
</h2>
<h2 class="hide">
		Sibling3
</h2>
<h2 class="show">
		Ancestor
</h2></pre><br />

Is there a more straightforward and economical way of doing this? There are a lot of level 1 assets and I'd like to avoid having a design customisation for each one.

Use an Asset Lineage design area with "levels_to_print" set to 1. :) That way, it only ever prints the first level, which is what you want.

Sorry Avi, confusion there is my fault (mixing up my actual requirements with my test setup). :rolleyes:

I actually want to show the level 3 ancestor, and asset lineage won't let me decide the level at which to start printing, only how many levels to print (right?).

Is it always the third level? If so, you could do some menu-fu, by nesting empty <mysource_asset> tags:

    
    
       
       
    	  
    	  
    	  %asset_name%
    	  
    	  
       
       
    
    


Does this make (vague) sense?

Not really :(

Your example is a menu_normal, the outcome is the same as if you just stated level="3". This would still return all of the siblings of a level 3 ancestor, I want only the single level 3 item in the current page's hierarchy.

Ah, good point. I'm not sure there is a way to do what you want, unfortunately. Maybe someone else can think of something.

OK thanks for looking!

I guess I'd better use a [i]declared_vars[/i] and a customisation for each level 3 item I want to do this with.

Might be easier to do with a metadata field -- you don't need to create multiple customisations.