Main purpose is to be able to switch between similar pages with the same content with different languages. Other purposes can off course also be used.
This macro generates links to pages that relative have the same rank in respect to a given root page. This is done by lineage, so the order in which the pages are added is of importance. You will get the wrong pages if you change rank in one page or if there is an extra page in one language page tree, the next page will have a higher rank than his brother in the other page tree.
The macro takes key-value pairs as arguments, in which the key is a label for showing the link and the value the url of the page tree root asset.
Example:
^LanguagePageSwitch(Dutch,"/home/nl",English,"/home/en");
When a page with the macro is not in such a page tree, or when the root url does not exist, that is logged at error level.
When an asset has not a "brother" page, the link url will be that of the page root and at warn level an error is logged.
I have thought of an extra parameter where you can modify the lineage for in the script itself, but have not done so. The reason is that it was meant to be able to use it in a template on the whole page tree. So a correction in lineage is a solution that will not work properly.
Author: BartJol