URLS is your query just formatted along with the rest of the query.
My query using the cte does the following
SELECT urls.NodeAliasPath,
CASE
WHEN urls.DocumentUrlPath IS NULL
OR RTRIM(LTRIM(urls.DocumentUrlPath)) = '' THEN
urls.NodeAliasPath
ELSE
urls.DocumentUrlPath
END NavigationURL,
1 OriginalDocument
FROM urls
Provides the original documents along with their replacement if being replaced as you said with DocumentUrlPath -- if populated, this overrides the NodeAliasPath (replace ROUTE: with empty string)
Then I UNION the following aliases query
SELECT urls.NodeAliasPath,
AliasURLPath,
0
FROM urls
WHERE urls.AliasURLPath IS NOT NULL
and then the order by moves all the nodealiaspaths together
ORDER BY urls.NodeAliasPath,
OriginalDocument DESC;
Example of one document below
Node Alias Path |
Navigation URL |
Original Document |
/Propane-Finder |
/Propane-Finder |
1 |
/Propane-Finder |
/finder |
0 |
/Propane-Finder |
/Location |
0 |
/Propane-Finder |
/Locations |
0 |
/Propane-Finder |
/nearme |
0 |
/Propane-Finder |
/tv |
0 |
Which matches the page setting sin cms. The 2nd column is the value I wanted.