Community

Backlinks from dynamically generated lists as opposed to nodes

I've been working on a module for one of my D7 sites for a custom content type specific to the site. In my module's menu code, I've got handlers defined for /treasure_hunt/%Type (which optionally has a year parameter as well). This part is working great. I get my list of treasure hunts of the specified type. What I'm curious about is whether the backlink system can correctly generate backlinks between the overall list page and the individual treasure hunts. So that when you go to the backlinks on /treasure_hunt/Hunt_Type/2010, it shows that /treasure_hunt/Hunt_Type links to it. I've yet to find a way, and I suspect that the dynamic pages aren't indexed, and so the backlinks aren't possible, but I'd like confirmation.

I suppose that if its not doable, I could always create another node type that contains the description and work around the indexing that way. Thoughts on that idea would be appreciated!

Comments

you could do this in the theme layer

You could use a page or node pre-processors to

  • Check the URL
  • If it is a URL for a type of hunt, create the base URL in a theme variable
  • Output that theme variable / link in your node template or page template

you could do this in the theme layer

You could use a page or node pre-processors to

  • Check the URL
  • If it is a URL for a type of hunt, create the base URL in a theme variable
  • Output that theme variable / link in your node template or page template

I'm not quite following you

I'm not quite following you with this. It's the dynamically generated list page that is never indexed within Drupal, and as such, won't ever be known as having a link to the page that does exist as a node. It sounds like you're suggestion works on the hunt nodes themselves instead of at the index. Or am I misunderstanding something?

I'm not sure I follow

When you say the page is not "indexed within Drupal", what are you referring to? Also, did you build your own custom list page with Views, or did you code one? Also, what are you calling the "backlink system"?

I'm referring to my

I'm referring to my dynamically generated list page. Since its only displayed by calling my module, and isn't in the node table, it doesn't get indexed by the searching mechanism. I actually coded the page myself as follows inside the page callback that handles the URL string:

  $huntRows = "";

  foreach ($result as $record) {
    $huntRows .= generate_listing_row_from_hunt($record);
  }
  $result_table = "<table class='treasure-hunt-list-table'>\n<thead><tr><th>Year</th><th>General Loc
ation</th><th>Pinpointed Location</th><th>Concealer</th></tr>\n</thead>\n<tbody>\n$huntRows\n</tbody
>\n</table>\n";

  return array('#markup' => "<p>$description</p>\n$result_table");

When I'm referring to the backlinks, I'm referring to the contents of the "what links here" tab on my node. I'd like, if possible, for my index, as coded above (or from a view if that's a better way to go) to show up in that list.