How To Create HTML Site Map For Genesis Metro Theme

Today I had a little problem with making HTML site map for 87studios. As you may see I recently switched to Genesis Framework and Metro theme. So now creating custom page templates is not as simple like before in regular theme, but all in all switching to Genesis was a milestone in my blogging life. Little more effort is nothing when you compare Genesis and regular theme performance, power and flexibility.

Why you should have HTML site map?

An HTML site map is a regular web page that can be read by any bot crawling the internet, and by regular web users. HTML site map contains links to pages on your site. If you have a large site, you would list the main pages (e.g. category pages) of the site which takes you to a sub site map with links to pages within that category. It's one of many possible ways to create it. For smaller sites like mine it's enough to make one with ordered links.

In one of Matt Cutts' videos on SEO questions, he answers a question about if you should build an HTML or XML Sitemap.

The solution

After short introduction it's time to create HTML site map. As I mentioned in the first paragraph, there I had some problems at the beginning, but finally I did it using two sources. Yoast's guide and Genesis 404.php file. After juggling with code for a few minutes I got perfect and 100% working template. It's fully compatible with Metro theme, but you should easily adapt it to any Genesis child theme.

So, here is the complete solution to get HTML site map for Genesis Metro child theme.
Just create a sitemap_template.php file, paste my code, save it and upload to your theme folder. As a next step create a blank page, give it a title and change template from default to sitemap. That's all. I hope you enjoy it! Share your thoughts in comments.


* Genesis Framework.
* WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances.
* Please do all modifications in the form of a child theme.
* @package Genesis\Templates
* @author StudioPress
* @license GPL-2.0+
* @link
Template Name: Sitemap

//* Remove default loop
remove_action( 'genesis_loop', 'genesis_do_loop' );

add_action( 'genesis_loop', 'my_sitemap' );
* This function outputs a 404 "Not Found" error message
* @since 1.6
function my_sitemap() {

echo genesis_html5() ? '<article>' : '<div>';

printf( '<h1>%s</h1>', __( 'Sitemap', 'genesis' ) );
echo '<div>';

if ( genesis_html5() ) :

echo '<p>' . sprintf( __( 'All pages and post, enjoy :)', 'genesis' ), home_url() ) . '</p>';

else :

<p><?php printf( __( 'All pages and post, enjoy :)', 'genesis' ), home_url() ); ?></p>

<h4><?php _e( 'Pages:', 'genesis' ); ?></h4>
<?php wp_list_pages( 'title_li=' ); ?>

<h4><?php _e( 'Categories:', 'genesis' ); ?></h4>
<?php wp_list_categories( 'sort_column=name&amp;title_li=' ); ?>

<h4><?php _e( 'Authors:', 'genesis' ); ?></h4>
<?php wp_list_authors( 'exclude_admin=0&amp;optioncount=1' ); ?>

<h4><?php _e( 'Monthly:', 'genesis' ); ?></h4>
<?php wp_get_archives( 'type=monthly' ); ?>

<h4><?php _e( 'Posts:', 'genesis' ); ?></h4>
// Add categories you'd like to exclude in the exclude here
$cats = get_categories('exclude=');
foreach ($cats as $cat) {
echo "<li><h3>".$cat->cat_name."</h3>";
echo "<ul>";
while(have_posts()) {
$category = get_the_category();
// Only display a post link once, even if it's in multiple categories
if ($category[0]->cat_ID == $cat->cat_ID) {
echo '<li><a href="'.get_permalink().'">'.get_the_title().'</a></li><br />';
echo "</ul>";
echo "</li>";


echo '</div>';

echo genesis_html5() ? '</article>' : '</div>';


Divi 2.0 WordPress Theme

Like what you read here in this blog post? If yes, please sign up and get latest articles delivered to your email account for FREE! You’ll be also subscribed to newsletter, where I share a exclusive content and offers.

About Kris Hoja

Hi! I'm Kris. For a while I was blogging about WordPress, now I'm owner of HogStudio - Creative Agency focused on website development.
Add me on Google+ and don't forget to follow me on Twitter :)


  1. I am using Genesis 'Megazien Pro' child theme and not using Yoast. will it compatable with 'megazine pro' child theme?

    if I submit the URL of sitemap page to google search console will it work as sitemap? I will be glad if you answer. Thanks

  2. nice post. i will try it in my client project. thanks a lot.

  3. Hi, looks cool - But you say "copy my code" - can't see it.

  4. Wow Aweosme post,Nicely Explained how to create sitemap in Genesis Metro theme,great Work,Thanks.

  5. Very nice! I'm just starting out with Genesis myself and also use Yoast's sitemap template, so this was helpful.

    However, the way you have it written it doesn't actually output the sitemap content if HTML5 support is enabled. if ( genesis_html5() ) : checks for this, and if it's true then all we get is "All pages and post, enjoy :)" If it's false, we get the same message plus everything else. Nonetheless, a helpful snippet for a newb - thanks for posting!

    • Hi!
      Thanks for response.
      If you have errors, try to use shortcut to output sitemap [wpseo_sitemap] you can also choose not to display authors [wpseo_sitemap authors=no] or archives [wpseo_sitemap authors=no archives=no]
      Let me know if this helped.

Leave a Reply