Aloha Page Link Tag Description

A special tag-type may be defined, which will be used by Aloha to create internal link tags.

The tag-type must have the keyword “gtxalohapagelink”. Also, the internal definition must be equivalent to the one found in the screen-shot below – in particular, the part-keywords “url”, “fileurl”, “text”, “class” must be identical.

Contents of the part “Template”:


#if( "$!cms.tag.parts.title" != "" )##
#set( $escapedTitle = $cms.imps.velocitytools.esc.xml($cms.tag.parts.title) )##
#set( $title=" title='$escapedTitle'" )##
#end##
#if( "$!cms.tag.parts.target" != "" )##
#set( $target = " target='$cms.imps.velocitytools.esc.xml($cms.tag.parts.target)'")##
#end##
#if( "$!cms.tag.parts.url" != "" )##
#if( "$!cms.tag.parts.url.target.id" != "" )##
#set( $data = " data-gentics-aloha-repository='com.gentics.aloha.GCN.Page' data-gentics-aloha-object-id='10007.$cms.tag.parts.url.target.id'" )##
#else##
#set( $data = " data-gentics-gcn-url='$cms.imps.velocitytools.esc.xml($cms.tag.parts.url)'" )##
#end##
#set( $href = $cms.tag.parts.url )##
#else##
#set( $data = " data-gentics-aloha-repository='com.gentics.aloha.GCN.Page' data-gentics-aloha-object-id='10008.$cms.tag.parts.fileurl.target.id'" )##
#set( $href = $cms.tag.parts.fileurl )##
#end##
#if( "$!href" == "")##
#set( $data = " data-gentics-gcn-url='#'" )##
#set( $href = "#")##
#end##
#if( !($href.toString().startsWith("<plink")) )##
#set( $href = $cms.imps.velocitytools.esc.xml("$href") )##
#end ##
<a$!title$!target href="$href" class="$!cms.tag.parts.get('class')"$data>$!cms.tag.parts.text</a>##

The hashes in the content are important as they are velocity comments to prevent the rendering of new lines. If not all newlines are stripped out, the tag will be wrapped with a DIV in the edit view.

This tag-type must be linked to each node (root-folder) that has Aloha enabled.

A user can then create an internal link by inserting a link with the Aloha floating menu, and by beginning to type the name of the page/file he wants to link to. A number of suggestions will be displayed that match the typed text. Selecting one of the suggestions with the cursors-keys and confirming the selection with the enter-key will create the link tag once the page is saved.

A special part-type may be defined, which will be used by Aloha to add language to link tags.

endprologue.

For external links the user can choose the language in the link sidebar menu. For internal links, the language of the page will be used instead.

A part-type name ‘Language’ must be created. The following image shows the settings for this part-type:

The part ‘Template’ of the link tag must be updated with the next changes:

  1. Line 8-10: if the part-type language is set, we fill the ‘hreflang’ attribute with the value of the Language Part-type.

#if( "$!cms.tag.parts.language" != "" )## 
#set( $language = " hreflang='$cms.tag.parts.language'")## 
#end## 
  1. Line 14 : if the link references to an internal page, get the language of the referenced page.

#set( $language = " hreflang='$cms.tag.parts.url.target.language.code'")##
  1. Line 27 : set the hreflang into the link.

<a$!title$!target$!language href="$href" class="$!cms.tag.parts.get('class')"$data>$!cms.tag.parts.text</a>##