Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drupal Site Map Module

Tags:

drupal

I am looking for a module that can create sitemap in Drupal, but couldn't find any. I tried Site Map module, but it can only generate a sitemap page; it can't create a sitemap block at the end of every page. I also tried site menu module, but it can't create a sitemap block as shown above, as well.

Maybe it's just that I don't know how to configure, but I read every readme file, and tried for a few days, still can't get it to work.

Anyone has any idea?

like image 297
Graviton Avatar asked Apr 15 '09 11:04

Graviton


People also ask

What is sitemap Drupal?

The Drupal XML Sitemap module lets you create xml sitemaps that adheres to the sitemap.org guidelines. Sitemaps generated can be automatically submitted to search engines like Google, Ask, Bing, etc. The module is also flexible and comes with submodules that allow site admins to customize links and the output.

How sitemap is created?

There are various tools that can generate a sitemap. However, the best way is to have your website software generate it for you. For example, you can extract your site's URLs from your website's database and then export the URLs to either the screen or actual file on your web server.

What is sitemap file?

A sitemap is a file where you provide information about the pages, videos, and other files on your site, and the relationships between them. Search engines like Google read this file to crawl your site more efficiently.

How do I add breadcrumbs to Drupal 8?

$breadcrumb = new Breadcrumb(); Creating an object of Breadcrumb Class. $breadcrumb->addLink(Link::createFromRoute('Home', ' ')); In adding link to the breadcrumb class object, we need to pass object of Link class for creating a link.


2 Answers

I had the same problem, after trying a module (site-map) but missing customization options I wrote a custom module. Took less time then messing with the site-map module, for just getting a site map the following code is enough (adapt your-menu):

function sitemap_render_menu ($menu) {
    $output = "<ul>";
    foreach ($menu as $item) {
    $link = $item["link"];
    if ($link["hidden"]) {
        continue;
    }

    $output .= "<li><a href=\"" . check_url(url($link["href"], $link["options"])) . "\">" . $link["title"] . "</a></li>";

    if ($item["below"]) {
        $output .= sitemap_render_menu($item["below"]);
    }
    }

    $output .= "</ul>";
    return $output;
}

function sitemap_content () {
    $output = "<h1>Sitemap</h1>";
    $output .= "<span id=\"sitemap\">";
    $output .= sitemap_render_menu(menu_tree_all_data("your-menu"));
    $output .= "</span>";
    return $output;
}


function sitemap_menu () {
    $items = array();

    $items["sitemap"] = array (
        "title" => "Sitemap",
        "page callback" => "sitemap_content",
        "access arguments" => array("access content"),
        "type" => MENU_CALLBACK);

    return $items;
}
like image 168
Elmar Weber Avatar answered Sep 28 '22 04:09

Elmar Weber


There is a basic comparison of sitemap modules at http://groups.drupal.org/node/15980

I have used sitemenu and it worked for my needs, but the real answer depends on how you structure your site with taxonomy, content types, etc.

like image 24
greggles Avatar answered Sep 28 '22 04:09

greggles