Show "no menu" pages in sitemap

asked Feb 18, 2014 by carlo15 (450 points)
Hello,
when generating the sitemap, only flat menu pages and main menu pages are included in the list.

All the "no menu" pages, actually the majority of my content, are excluded from the listing,

I am running Seotoaster v2.1.0 with ecommerce.

How can I fix this?

Thank you,
Carlo

2 Answers

answered Feb 18, 2014 by Vitaly (1,040 points)
Hello, Carlo.

Please provide us. You are look  http://sitename/sitemap.html  or http://sitename/sitemap.xml?
commented Feb 18, 2014 by carlo15 (450 points)
Hello Vitaly,

thank you for answering me.

I was looking at the .html page, the .xml version is complete.

How can I make the .xml version renders in the .html page?

Thank you!
commented Feb 18, 2014 by Vitaly (1,040 points)
To do this, you must make changes in sitemap.php.

Best regards, Vitaly.
commented Feb 18, 2014 by carlo15 (450 points)
Ok, thanks! I will take a look at it and update you in case I need further help.
commented Feb 18, 2014 by carlo15 (450 points)
Hi, I figured out how to solve it, thanks to your suggestion.
I sent the sample code to SeoToaster dev team for a compliancy check, I will post it here when they give me green light.
answered Feb 19, 2014 by Artem (1,320 points)
Hello,Carlo.
We took into consideration your suggestions regarding sitemap "nomenu pages", this functionality will be in the next release of SeoToaster.
commented Feb 19, 2014 by carlo15 (450 points)
edited Apr 1, 2014 by carlo15
Hello Artem,
I'm glad to hear that!
Here's the code to add in the default Seotoaster files, so even users who do not upgrade will benefit from this solution:

add this in sitemap.php after
$flatPages = Application_Model_Mappers_PageMapper::getInstance()->fetchAllStaticMenuPages();

-----------------------

 /* we add standard pages */
 $nomenuPages = Application_Model_Mappers_PageMapper::getInstance()->fetchAllNoMenuPages();

------------------------

Near the end of file, after:

$this->_view->pages      = $pagesList;
$this->_view->flatPages  = $flatPages;

Add this code on a new line:

$this->_view->nomenuPages  = $nomenuPages;

------------------------

add this to sitemap.phtml after flat menu pages

-----------------------

<!-- nomenu pages here -->
<?php if(!empty($this->nomenuPages)): ?>
 <ul class="sitemap">
 <?php foreach ($this->nomenuPages as $key => $page): ?>
 <?php $page = $page->toArray(); ?>
 <li class="page"><a title="<?php echo isset($page['optimizedH1']) ? $page['optimizedH1'] : $page['h1']; ?>" href="<?php echo $this->websiteUrl . (isset($page['optimizedUrl']) ? $page['optimizedUrl'] : $page['url']); ?>"><?php echo (isset($page['optimizedNavName']) ? $page['optimizedNavName'] : $page['navName']) ; ?></a></li>
 <?php endforeach; ?>
 </ul>
<?php endif; ?>

---------------------

For everyone using this: mind not to break any line in the posted code and always make a backup of original files before doing any change!

Trust me, you will thank yourself for doing this when you mess up something - and it happens.

Enjoy!
commented Apr 1, 2014 by carlo15 (450 points)
Hello,

I noticed I didn't mentoned another necessary edit to the core files, in order to render nomenu pages in the sitemap.html page.

I edited my answer with the full working version.
...