8

I wouldn't mind showing my XML sitemap to users if there were a way to make it human usable as opposed to just machine readable. Is it possible to:

  • Choose the colors and layout
  • Make the locations into links
  • Allow sorting based on the field (location, last modified, etc)

I was thinking that XSLT might be a possibility, but I haven't explored it. If it is possible, please provide a minimal example.

Stephen Ostermiller
  • 98,758
  • 18
  • 137
  • 361
  • For a trivial/small site, the navigation should be enough to guide users to the content they need. For a larger site, a sitemap with all URLs will be overwhelming. Sure you can technically do that, but does it really make sense for your users? – John Mueller Apr 28 '15 at 20:40
  • I've seen sitemaps show up in search results and I was thinking that making them usable might be a better solution than noindexing them. – Stephen Ostermiller Apr 28 '15 at 23:37
  • You can do a lot with XSLTs; we made some nice ones back in the day, and many sitemap generators include them by default (eg, http://johnmu.com/sitemap.xml ), but in the end I don't think they're really that useful to users, I'd just noindex them if they showed up in normal search for the site's keywords (that's probably a sign that something else is wrong with the normal pages anyway). – John Mueller Apr 30 '15 at 18:38

2 Answers2

9

Yes. Everything you ask for is possible. And here's an example XML sitemap file generated by the Drupal XML sitemap module with a little bit of configuration. Everything is done for you out of the box.

http://softkube.com/sitemap.xml

If you check the code of the XML file there's a link to an XSL and inside that file you can see the code with references to JS and CSS files and more or less similar to an HTML file.

The above you get almost free (with little config that is) with Drupal and its XML sitemap module. Now check this:

http://softkube.com/sitemap

This is custom made code we wrote to automatically display all the pages (blog posts, portfolio items, etc) in a user friendly sitemap format. I'm not aware of an automated way to go about this as this tends to be site specific. In my opinion, this is more user friendly and also keeps the website's navigation and footer and everything.

Hope this helps and good luck.

Mario Awad
  • 441
  • 2
  • 8
2

Of course. XML is just XML and can be served as XHTML by using XSL if you wish and styled with CSS.

Rob
  • 4,613
  • 2
  • 20
  • 25
  • Do you have a minimal example of an XSLT stylesheet that will transform a sitemap? – Stephen Ostermiller Apr 23 '15 at 12:29
  • No but, years ago, I used to serve my personal web site from XML as XHTML as I described. XSLT is a different animal. – Rob Apr 23 '15 at 12:29
  • I've used XSLT server side and I've seen it used client side to make RSS feeds pretty. I've never seen an example applied to a sitemap file, but the possibility intrigues me. – Stephen Ostermiller Apr 23 '15 at 12:30
  • @StephenOstermiller Without giving it any thought at all, the code should be the same. – Rob Apr 23 '15 at 12:32
  • @StephenOstermiller Was trying to think of a site that used styled XML...The Yoast SEO wordpress plugin uses it with CSS in the <head> of the .xsl template. Install the plugin then view-source:https://yoursite.com/main-sitemap.xsl. Doing it this way will make chrome complain in console that Resource interpreted as Stylesheet but transferred with MIME type text/xml: – dhaupin Apr 23 '15 at 13:44
  • Adding a stylesheet to an XML file is as easy as right after – nathangiesbrecht Apr 23 '15 at 15:11
  • 1
    "XSLT is a different animal." - Isn't XSLT what is required here? XSL is just a group term encompassing these technologies. (?) – MrWhite Apr 24 '15 at 08:37
  • @w3d Well, there's XSL-FO and XPath, which I don't recall if it falls under the XSL banner, but both of those are needed by some to do further manipulation of documents that XSLT can't do on its own. – Rob Apr 24 '15 at 12:42