【问题标题】:How do you add a view to the sitemap generated by the XML Sitemap module in Drupal?如何向 Drupal 中的 XML Sitemap 模块生成的站点地图添加视图?
【发布时间】:2011-07-03 15:53:09
【问题描述】:

我有一个包含多个参数的 Drupal 6 视图。我想将每组唯一的参数/页面添加到由 Drupal 中的 XML 站点地图模块创建的站点地图中。我有一个自定义模块,它为传递到视图中的每个可能的参数组合创建一个菜单项,因为它们的数量是有限的。

我尝试按照以下说明进行操作: http://drupal.org/node/507674 但这没有用。

然后我尝试使用这个出色的评论以编程方式添加这些链接: http://drupal.org/node/711100#comment-3150592

但是,在我在循环调用 xmlsitemap_link_save() 中创建的 150 多个链接中,只有 1 个被保存。与未添加到站点地图的其他条目相比,该链接条目没有我能检测到的任何独特特征。

我在数组 $links 中构建所有链接。这是一个典型的数组条目:

$links[] = array(
    'type' => 'mymodulename',
    'id' => '3000-10000',
    'loc' => 'washington-dc',
    'lastmod' => time(),
    'changefreq' => 4600,
    'priority' => 0.5,
);

我正在尝试描述 URL:

example.com/washington-dc/3000-1000

然后我循环整个 $links 数组以保存每个链接:

foreach($links as $link) {
    xmlsitemap_link_save($link);
}

最后,所有这些代码都在函数中:

mymodule_xmlsitemap_links()

我从 hook_cron 调用:

function mymodule_cron() {
    mymodule_xmlsitemap_links();
    return true;
}

我已经确认:

  • 我的 hook_cron() 在 cron 期间被调用
  • 仅保存 $links 中的一个链接
  • sitepmap 模块设置中要处理的链接总数设置为 250,对于我的 $links 数组(~150)和现有站点地图(47 个链接)来说已经足够了
  • 日志显示正在生成 XML 站点地图,并且没有报告错误

知道我做错了什么吗?

【问题讨论】:

    标签: xml drupal drupal-6 drupal-views sitemap


    【解决方案1】:
    'id' => 'Unique ID'  
    'loc' => 'example.com/washington-dc/3000-1000', Full path.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多