Solprovider Lenya Kongregate Registration for Free Flash Games and Chat with solprovider

Menu Entries Linking to External Websites

This article is about using the standard Lenya menu to link to a URL other than the current document. It describes several options that do not work, and one option that does work but requires manually editing a file.

Research


We have a similar architecture on a non-Lenya system. (Using Lenya terms) there are several publications with the top-level publication having menu links to documents and other publications, and the others having documents and a "Return to Home Page" menu link. Rather than building a new DocType, we create standard documents with the content:
<SCRIPT LANGUAGE="JAVASCRIPT">
window.location="http://solprovider.com/lenya";
</SCRIPT>

The page starts to load, then the browser loads the "external" URL. This does not work well with Lenya. The Kupu editor gives many errors. Accessing the page in the GUI will load the external page, so you never edit it again.

Another method is create a new DocType. The "Redirect Location" Field should set the JS, the META REFRESH, and a link in the content for "Click here to go to the external page" for when browsers do not handle it automatically. It could also set a flag in the navigation elements so the menus can add a symbol for "This menu item goes to an external website." I did not test that method.

The best method would be the menu link directly refers to the external website. In Lenya 1.2, navigation uses sitetree.xml without looking at the document files. sitetree2nav.xsl has a bypass so if sitetree.xml has an entry:
<node id="externaltest" visibleinnav="true" href="http://solprovider.com">
<label xml:lang="en">External Test</label>
</node>

Then the menu entry will link to the external website. If you add the HREF to the Live version (content/live/sitetree.xml), it will survive the document being published again.

Using the GUI would be very difficult. It requires a method to edit the HREF property in sitetree.xml, similar to the "rename-label" Usecase. There is no Ant task for editing the HREF. Worse, if the HREF attribute exists in the Authoring SiteTree (content/authoring/sitetree.xml), the GUI will not be able to access the document. If it is named something like "livehref", you need to reprogram the publishing system to change the attribute name during publishing. It must be done during publishing because non-standard attributes will not be copied by the default publisher.

Solution

The best solution without completely rewriting Lenya is to manually add the HREF attribute to the "node" entry in content/live/sitetree.xml. Then clear the cache if you are using one.

<< Menu: InternalMenu Entries without Documents >>

Contact Solprovider
Paul Ercolino