How to add sitemap to website

Permalink 3 users found helpful
I know there is a sitemap within the CMS. My question is how do I display a sitemap like that in my website? Is there a plugin? I like the sitemap to be able to update automatically in the same way the sitemap wihtin the CMS backend updates when I add a page. I just like to have page called sitemap for my visitors to see. I have searched the forum but have not found an answer yet. Anybody?
View Replies: View Best Answer
lynvcode replied on at Permalink Reply
lynvcode
Add an autonav block
use display all on everything
uce2009 replied on at Permalink Reply
Is there any other plugin I could use? If I follow your instructions the sitemap is displayed in the css of the navigation which I am already using for my site but I want to have a different css for the sitemap displaying.
nickratering replied on at Permalink Reply
nickratering
Copy the block autonav to the blocks directory in root.
If not there, create a new directory 'templates'.
In the templates dir create a folder with a name you like, for example 'website sitemap'. Copy the file view.php to this dir and add a 'view.css'. From here you'll be able to customise the looks of the front-end sitemap, wich now will appear in the custom template of the block. Good luck!
Pritam replied on at Permalink Reply 1 Attachment
Pritam
I have two instances of autonav on a site, one in the side bar and one on the header, I was trying to print the sitemap, to a sitemap page using the auto-nav block, however I am unable to get all the pages on three levels to show up to show up in the sitemap.

What happens is after selecting one of the levels and Display all, either the pages in the top nav bar show up or the side-nav bar on choosing the third level.

Hope someone can point me on what I may be doing wrong,Attached is the sitemap from the dashboard
invision replied on at Permalink Best Answer Reply 1 Attachment
invision
Pritam,

Are you trying to display a sitemap to display to your site's visitors, or create a sitemap.xml file for the search engines?

Either way, Concrete5 can do either for you.

If you want to generate a sitemap.xml for the search engines, go into the dashboard > system & maintenance > jobs & check 'Generate Sitemap File' -- then, click the "run checked" button on the right site. C5 will generate a sitemap.xml file of your website.

If you want to display a sitemap for visitors, the earlier poster was on the right track. Add an autonav block to your page with the settings like the attached screen shot. After you exit the block and save the page, the page will display a complete hierarchical listing of your entire site. If you want anything more customized than that, then you'll have to style it using Cascading Style Sheets (CSS) or a custom template of the block.
Pritam replied on at Permalink Reply
Pritam
Thanks @Invision, it worked perfectly, I wasn't able to mark your post as the best answer, but marked the discussion as helpful.
tstrudwick replied on at Permalink Reply
possibly a dumb question, but now that i have updated to 5.5, i cannot find an option for generating my xml sitemap.

any pointers?


thanks.
nickratering replied on at Permalink Reply
nickratering
Goto system and settings, click automated jobs and hit the play-buttons!
davidwillmott replied on at Permalink Reply
davidwillmott
I having trouble adding the pages in site-map which have been excluded from the main Nav.
I see all my pages in the dashboard site main would just like a page on the site which shows up all my pages.
Any ideas?
jmitri replied on at Permalink Reply
I also need help with this same issue.
jmitri replied on at Permalink Reply
When I set the auto-nav as you have in your attachment, it only show the pages that are in the nav and not the pages that are excluded from the nav? any suggestions of how to show all of the pages in the sitemap?
invision replied on at Permalink Reply
invision
I haven't done much with Concrete5 since 5.5, but there used to be 2 page attributes: one to exclude a page from auto-nav, another to exclude a page from page lists. Be sure you don't have the "exclude from page list" attribute set, and instead of an auto-nav create your sitemap from a page list block.

Hope this makes sense.

Actually just tried this, and the page list block displays page titles & descriptions. It would work, but needs some adjustment in the selection of what pages to display (to show the site hierarchy, for example). I'm really surprised this hasn't been tackled in the add-ons marketplace.
jmitri replied on at Permalink Reply
That works! Great and thank you!
jmitri replied on at Permalink Reply
It does show descriptions, but you can limit the amount of characters displayed. But at least it displays all of the pages.
invision replied on at Permalink Reply
invision
With a minor change to some php, you could effectively disable the "exclude nav" feature in a custom template for the autonav block.

My site is still running 5.4.2.2, so this may have changed a bit for newer versions. First, create this in your site: blocks/autonav/templates/ -- create this directory in your website's 'root' folder.

From concrete/blocks/autonav/ directory, copy view.php and put it into that new templates folder. Give it a distinctive name, like 'noexclude.php' or something similar.

Open the file in your favorite code editor and look for this code (it's line 25 in my version):
if (!$_c->getCollectionAttributeValue('exclude_nav')) {

You can "comment" that code out by adding two slashes to the beginning of the line, so it looks like this:

//if (!$_c->getCollectionAttributeValue('exclude_nav')) {

Note the curly brace on the right end of that line -- that is the start of the code to be executed when this 'if' statement is run. You'll need to find the corresponding closing curly brace. In my file, it's on line 78. Comment that out as well, so the line looks like this:
//}

You've effectively disabled the 'if' statement. You've told the template to show ALL pages, not just ones without 'exclude_nav' checked. Upload that to your server.

Place an 'autonav' block on your sitemap page with the settings to show all pages & sub-pages. Once the block is there, click and select 'custom template' and if you did all the above correctly, you should see your new template in the list of available customizations. Select that, and you'll get all the pages from the website displayed.
lpsnoops replied on at Permalink Reply
lpsnoops
Great!!! this really works for me. You can view the result inhttp://www.adiasreparacoes.com/index.php/mapa/...

Thanks Invision,
keep the good work :)
invision replied on at Permalink Reply
invision
Glad to help. I'm not the sharpest tool in the shed, but sometimes I hit pay dirt, if you know what I mean.
keeasti replied on at Permalink Reply
keeasti
I think the way autonav is handled is a bit different in Concrete 5.6

From what I can see, the if statement has moved from the view.php to /concrete/core/controllers/blocks/autonav.php

Has anybody figured out how to create a custom controller which one can apply to a block?

I want to to be able to add a page attribute like exclude_header_nav to apply to the header navigation. This would then allow for a sitemap autonav block lo list all pages including the ones which were excluded from the header nav.

Tweaking the PHP is not the problem ... I am just unsure where to place this modified controller.php file exactly so it is picked up.

A related problem I have found is that if you create a page called 'sitemap' it all works well until you generate the sitemap.xml file which lives in the root folder. Clicking on the sitemap link then throws up a page not found 404 error. Pretty URLs are enabled ... haven't been able to try it without.

My workaround is to call the page path site-map (or anything other than sitemap)but it would be interesting to find out why this happens
invision replied on at Permalink Reply
invision
You should be able to duplicate controller.php from an add-on to the blocks folder to write your own override.

Depending on the add-on, you should be able to copy an entire add-on to the root Blocks folder and tweak the code to override without affecting the core or the add-on -- just select the template for that block when you place it.

'sitemap' created in Concrete5 and sitemap.xml shouldn't have any conflict with each other. A page created in C5 isn't actually a physical file so they should be able to co-exist just fine.
keeasti replied on at Permalink Reply
keeasti
Thanks for the reply.

I have modified the controller file and it tests ok when I do the change to the core file but it is not being picked up when I put it in as an override. As it is the autonav block, the code for it is in the core folder so I am not sure where the modified one should go.

Also the new autonav controller just extends the core ... all it has in it is this:

<?php 
   defined('C5_EXECUTE') or die("Access Denied.");
   class AutonavBlockController extends Concrete5_Controller_Block_Autonav { }
   class AutonavBlockItem extends Concrete5_Controller_Block_AutonavItem { }


I understand that one has to copy the required function from the core file and put it inside the controller. This worked fine on a different block I was working on.

As for the sitemap page, I know what you are saying but I have actually tried this and the behaviour does occur ... try adding a page called sitemap at the top level and then generate sitemap.xml ... the two do clash (at least with pretty URLs enabled). I will investigate this a bit further and post what I find.

Sitemap update
This seems to be due to some 1and1 shared hosting weirdness as it doesn't happen on our dedicated server. Will look into it some more.
kirkroberts replied on at Permalink Reply
kirkroberts
I know this is an old thread, but for anyone looking to show pages that have "exclude from nav" checked (e.g. for a page listing on a sitemap page) you don't have to change the autonav controller in Concrete5 version 5.6. Just pass "true" in the getNavItems() in your autonav template.

Details:http://concrete5tricks.com/blog/ignore-exclude-from-nav-attribute-i...