Board Thread:Support Requests - Getting Technical/@comment-961279-20130511174624/@comment-961279-20130519150829

I think you just gave me the answer, but let me see if I can clarify what I am trying to do.

Simpsons Wiki uses a template to put links to the previous and next episode on each episode's page (the PrevNext template). Those two are manually specified on every page where the template is used, and there can be up to six sub-pages for each episode, so there's a switch that tacks on "/Credits", "/Appearances", etc., to both links.

What I am trying to do automate this navigation as much as possible. We just had a situation where Fox changed the order of the episodes again, so that means there's about 20-50 pages that have to be updated manually every time this happens, depending on the new order of the episodes.

The template that is doing the work is Eps-PN. The way it works is this:
 * 1) It uses BASEPAGENAME to retrieve the name of the episode this template is being used on and feeds it into the Eps-In switch.
 * 2) Eps-In returns a number based on the episode. Some punctuation breaks this match, so the Eps-PN template has a spot where you can specify the episode number as an override. In this case, the same number that was fed in comes back out. This saves having to convert apostrophes to the Unicode value like I mentioned yesterday.
 * 3) The number that is retrieved is used in two different spots. In one, 1 is subtracted from it to get the previous episode. In the other, 1 is added to it to get the next episode.
 * 4) Both of those values go into the Eps-Out switch to retrieve the appropriate episodes.
 * 5) Links are created to those previous and next episodes back in the Eps-PN template. The template puts an arrow next to each link and makes the arrow a link also, so there are two previous links and two next links.
 * 6) Those links may go to a sub-page, so a switch called "Switch E1" tacks on the appropriate sub-page name (/Appearances, /Quotes, etc.), but keeps the displayed name as just the episode name.

Step 5 is where the template is breaking because it displays the page name as text instead of as a link. I put some examples at the bottom of the Eps-PN template to show where it's breaking. The first example is the calculation to subtract one from the episode number.

I think the answer is to change the Eps-Out switch from having just the names of the episodes to having the actual links to them. That way, building the link is already done in the separate template and Eps-PN can concentrate on selecting it.

I have already had to do something like this for the navigation at the bottom of each page that shows the episodes from each season. You can see that here. It's dorky, but it works.