Forum:Questions on Navigation Templates

I have been trying to make a Navigation template for a couple different wikis, that interact with categories of a specific page that refer to the main page. For example, my Montezuma page (Montezuma), the gallery of the main page (Gallery:Montezuma), and the Trivia of the main page (Trivia:Montezuma).

So when you click on the Gallery link on the Montezuma page, the Navigation template will be there at the bottom so you can return to the main page of Montezuma or click on Trivia while on the Gallery page, but when I add PAGENAME to the specified table I'm working on, it will bring up Gallery:Montezuma, Gallery:Gallery:Montezuma, and Trivia:Gallery:Montezuma, rather than {{Montezuma, Gallery:Montezuma, and Trivia:Montezuma across each page. Is there a way I can fix this?

Pylraster (talk) 17:58, October 29, 2012 (UTC)