If I understand you correctly, you would like a way to have the URL Path know which template you’d like the entry to be displayed on in the link generated?
There is currently no real “easy” way due to the nature of it. But there are a couple workarounds…
You can do this basing off of Weblog structure, Category structure, or Custom Fields.
Weblog Structure:
For example, you could create the template group in your to match the Weblog an entry belongs to with the {weblog_url} variable. So, if an entry was to belong to Weblog “Weblog B” and the URL Title for the Weblog (which is changable) is say “template_group_b”.... create your Template Group you’re linking to to match that URL Title.
<div class="title"><a href="/{weblog_url}/comments/{entry_id}/">{title}</a></div>
When the entries populate, the {weblog_url} variable will fill in with the cooresponding template name it was designated… example:
<a href="template_group_a/comments/1"}">Title of entry 1 from Weblog A</a>
<a href="template_group_b/comments/2"}">Title of entry 2 from Weblog B</a>
<a href="template_group_c/comments/3"}">Title of entry 3 from Weblog C</a>
<a href="template_group_a/comments/4"}">Title of entry 4 from Weblog A</a>
<a href="template_group_c/comments/5"}">Title of entry 5 from Weblog C</a>
Category Structure:
For example, you could create the template group in your to match the Category an entry belongs to with the {category_url_title} variable. So, if an entry was to belong to category “Category B” and the URL Title for the category (which is changable) is say “template_group_b”.... create your Template Group you’re linking to to match that URL Title.
<div class="title">{categories show="1|2|4|5|7|9|"}<a href="/{category_url_title}/comments/{entry_id}/">{title}</a>{/categories}</div>
In that example, use the show=“” parameter only if your entries belong to multiple categories… primarily, in the case of Sub Categories. What will happen is you’ll get the results for BOTH categories in the URL Title. The show=“” parameter would weed out say Primary Categories or Secondary Categories, of which ever you select. In the case that you have entries that belong to multiple Categories that you need both/all listed, you’re out of luck. Use Custom Fields.
When the entries populate, the {category_url_title} variable will fill in with the cooresponding template name it was designated… example:
<a href="template_group_a/comments/1"}">Title of entry 1 from Category A</a>
<a href="template_group_b/comments/2"}">Title of entry 2 from Category B</a>
<a href="template_group_c/comments/3"}">Title of entry 3 from Category C</a>
<a href="template_group_a/comments/4"}">Title of entry 4 from Category A</a>
<a href="template_group_c/comments/5"}">Title of entry 5 from Category C</a>
Custom Fields:
First, you create a custom field as you normally would, but make it a dropdown menu, with the cooresponding template Names…
ex: template1, template2, template3, etc
Every time you or an author creates a new entry, have them select the cooresponding template name from that dropmenu. That data is then posted…
We’re going to say you call that custom field “template_name”, and that you’re using Template Groups for each different templated entry. We’re also going to assume in the example that you’re using a Template called “comments” for each Template Group to display the entries. (You could also do this roughly the same way if you want to use the SAME Template Group for all entries, but a different Template…. just switch a couple things around).
Now, when you generate your links for the related entries, you can make your related entries code look exactly as this:
<a href="{permalink="{template_name}/comments"}">{title}</a>
When the entries populate, that custom field will fill in with the cooresponding template name it was designated… example:
<a href="template1/comments/1"}">Title of entry 1</a>
<a href="template1/comments/2"}">Title of entry 2</a>
<a href="template3/comments/3"}">Title of entry 3</a>
<a href="template2/comments/4"}">Title of entry 4</a>
<a href="template1/comments/5"}">Title of entry 5</a>
Of course, you want to make sure that the Templating Structure matches those template names, in this case, that’s the location of the Template Group, so you’d want to make sure “template1”, “template2”, and “template3” would exist as template group names, and that the “comments” templates would exist within those groups.
Now of course, all the names I used were only examples, you can name anything whatever you like.