Quantcast
Channel: Issues for XML sitemap
Viewing all articles
Browse latest Browse all 1238

Custom XML Sitemap links table

$
0
0

Hello dear Drupalers,

I'm working on a project that generates multiple pages from a node. Long story short, on the node I define several list of words that the user can choose frome. By combining the words from each list, I generate an url that corresponds to a hook_menu that serves it and renders the page content based on those words.

Example:

Words selected in list 1: Plant, Harvest
Words selected in list 2: Potatos, Apples
Words selected in list 3: Monday, Sunday, Tuesday

Combinations:
Plant/Potatos/Monday
Plant/Potatos/Sunday
Plant/Potatos/Tuesday
Plant/Apples/Monday
Plant/Apples/Sunday
...
Harvest/Apples/Sunday
Harvest/Apples/Tuesday

The point is I know exactly how many urls I'm generating in every node as I can extract all possible combinations of words. I now want to put those URLs in the sitemap, but I'm having a bit of a hard time figuring exactly how to do it. The urls are unique (using the path from the node, as in "{nodeid}/Word1/Word2/Word3".

Now, the xmlsitemap table seems not to work for me as I can't establish an ID appropiate for every url, unless I start counting a lot and asking the database for the last available ID. That would be a way of doing it, but I don't like it much, because it doesn't let me query for all the links generated by a node, for example. A much better way would be to establish a key pair using node id in one field an keywords combination in another.

But from hook_xmlsitemap_link_info(), I see something like:

'base table' => 'mymodule',
'entity keys' => array(
  // Primary ID key on {base table}
  'id' => 'myid',
  // Subtype key on {base table}
  'bundle' => 'mysubtype',
),

Does it means I can set up my own table and define my own "xmlsitemap_link_save" function? I cannot find any info on what "hook_xmlsitemap_link_info()" is for, besides providing "information on the type of links this module provides.", so I'm a little bit lost. From xmlsitemap_save_link code I see no custom table is usable by that function, but I don't know about the sitemap.xml construction end.

Am I looking in the right direction or should I take a totally different approach on this?

Thank you!


Viewing all articles
Browse latest Browse all 1238

Trending Articles