Page 1 of 2
SiteMapMadeSimple with CGBlog- and/or News-Module?
Posted: Thu Apr 07, 2011 11:54 pm
by imeos
Is there any way to get blog- and/or newsentries from the CGBlog- and/or Newsmodule processed by SiteMapMadeSimple?
Those modules regularly generate new pages (e.g. urls) for which an automatic addition to the sitemap.xml would make the most sense.
Re: SiteMapMadeSimple with CGBlog- and/or News-Module?
Posted: Fri Jun 17, 2011 12:39 am
by paulbaker
Hmmm, I'd like this as well. This module gives the main news URL but none of the news stories are included in the feed.
e.g.
http://www.example.com/news/ is shown but
http://www.example.com/news/29/63/Outst ... ,JGDetail/ (a URL to a news story) is not shown in the feed.
I notice this feature has been requested since 2009:
http://dev.cmsmadesimple.org/feature_request/view/3369
Re: SiteMapMadeSimple with CGBlog- and/or News-Module?
Posted: Fri Jun 17, 2011 5:55 am
by nockenfell
Look here:
http://www.blattertech.ch/blog/6/Sitema ... eitern.htm
it's in german. copy the code in your SitemapMadeSimple Template, then it works.
Re: SiteMapMadeSimple with CGBlog- and/or News-Module?
Posted: Sat Jun 18, 2011 10:34 pm
by paulbaker
Hey thanks! This worked well.

This is what I ended up using in the template. Note for other users - the 2 instances of
63 below are the
content_id of the news detail page on my site - you'll need to change this for your own site.
Code: Select all
{capture assign='junk'}{news number='1000'}{/capture}
{foreach from=$items item=entry}
{assign var=utmpNEWS value=$entry->moreurl|replace:'//':'/63/'|replace:'http:/63':'http:/'}<url>
<loc>{$utmpNEWS}</loc>
<lastmod>{$entry->postdate|date_format:"%Y-%m-%d"}</lastmod>
<priority>{$page->priority}</priority>
<changefreq>{$page->frequency}</changefreq>
</url>
{/foreach}
Re: SiteMapMadeSimple with CGBlog- and/or News-Module?
Posted: Sat Jun 18, 2011 11:33 pm
by calguy1000
a: why not use the 'assign' parameter to news (it works by default for all module calls, and is faster than captur):
b: Why not use the 'detailpage' parameter to news... so you don't have
to do the search/replace
Code: Select all
{news number=1000 detailpage='news_detail' assign='junk'}
Re: SiteMapMadeSimple with CGBlog- and/or News-Module?
Posted: Wed Jun 22, 2011 12:00 am
by paulbaker
Thanks Calguy
I think the answer to your "Why not use...?" is "Because I didn't know how..."
I am now using your technique and my code is
Code: Select all
{news number=1000 detailpage='news-detail' assign='junk'}
{foreach from=$items item=entry}
<url>
<loc>{$entry->moreurl}/d,McFTDetail</loc>
<lastmod>{$entry->postdate|date_format:"%Y-%m-%d"}</lastmod>
<priority>{$page->priority}</priority>
<changefreq>{$page->frequency}</changefreq>
</url>
{/foreach}
That's neater. Note that I still need a suffix on the URL as shown in the code -
/d,McFTDetail in this case - otherwise some of the styling doesn't seem to work.
Re: SiteMapMadeSimple with CGBlog- and/or News-Module?
Posted: Tue Aug 30, 2011 2:24 pm
by Bilmartech
Can this be tweaked to be used with SEO Tools module?
That module doesn't have a default template where i can easily insert this code?
Worked Perfect!... quick question
Posted: Sat Mar 24, 2012 2:05 am
by fearmydesign
Thank you this worked perfect! Below is the code I used, but I have a question I couldn't figure out... where does the number 89 come from on my News module? I noticed all the articles have that number assigned, so I had to replace the '//' with that 89 as below. Thank you.
Code: Select all
{news number=1000 detailpage='news-detail' assign='junk'}
{foreach from=$items item=entry}
<url>
<loc>{$entry->moreurl|replace:'//':'/89/'|replace:'http:/89':'http:/'}</loc>
<lastmod>{$entry->postdate|date_format:"%Y-%m-%d"}</lastmod>
<priority>{$page->priority}</priority>
<changefreq>{$page->frequency}</changefreq>
</url>
{/foreach}
Re: SiteMapMadeSimple with CGBlog- and/or News-Module?
Posted: Sat Mar 24, 2012 8:23 am
by Jos
that would be the page id of your detailpage "news-detail"
Re: SiteMapMadeSimple with CGBlog and News-Module?
Posted: Fri Jan 04, 2013 3:49 pm
by myleen99
Hi, I followed the instructions I've found in the many posts about this subject and got it all working, however the actual sitemap.xml file is not updated while it has 0777 write permissions (checked with FileZilla).
This is my SiteMapMadeSimple template code for who is interested :
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">
{foreach from=$output item='page'}
<url>
<loc>{$page->url}</loc>
<lastmod>{$page->date|date_format:"%Y-%m-%d"}</lastmod>
<priority>{$page->priority}</priority>
<changefreq>{$page->frequency}</changefreq>
</url>
{/foreach}
{news number=1000 detailpage='nieuws' assign='junk'}
{foreach from=$items item=entry}
<url>
<loc>{$entry->moreurl}</loc>
<lastmod>{$entry->postdate|date_format:"%Y-%m-%d"}</lastmod>
<priority>{$page->priority}</priority>
<changefreq>{$page->frequency}</changefreq>
</url>
{/foreach}
{assign var='foo' value=$mod}{CGBlog detailpage='blog' assign='junk2'}{assign var=mod value=$foo}
{foreach from=$items item=entry}
<url>
<loc>{$entry->detail_url}</loc>
<lastmod>{$entry->postdate|date_format:"%Y-%m-%d"}</lastmod>
<priority>{$page->priority}</priority>
<changefreq>{$page->frequency}</changefreq>
</url>
{/foreach}
</urlset>
The sitemap-file content is showed correctly on the "info" tab in the SiteMapMS admin page. All news articles and blogposts are in the sitemap with the correct URL (I can copy/past them in my browser and end up on the correct page with correct styling).
When I verify
http://www.mysite.tld/sitemap.xml is see only the list of actual pages but not the news articles and not the blogposts.
Preferences:
Generate a static sitemap.xml file : YES
Dynamically update the static xml file when content is changed : YES
I've also clicked "Save Sitemap" button on the Info-tab, but without success of updating the static sitemap file.
Any idea what the reason might be ? Thanks for your feedback.
PS : I'm using 1.11.4 "Fernandina" with the latest versions of all modules.
Re: SiteMapMadeSimple with CGBlog- and/or News-Module?
Posted: Mon Jan 07, 2013 10:33 pm
by Rolf
You did chnage a page to set an event te recreate the sitemap?
What is your system information?
Grtz. Rolf
Re: [SOLVED] SiteMapMadeSimple with CGBlog- and/or News-Modu
Posted: Tue Jan 08, 2013 8:37 am
by myleen99
Rolf, thanks for the tip !
The sitemap.xml file is indeed automatically updated when a new page is created or modified. I had tested everything except this.
This topic is now closed for me.
Dirk.
Re: SiteMapMadeSimple with CGBlog- and/or News-Module?
Posted: Mon Oct 28, 2013 5:00 pm
by fearmydesign
As I can see from my own post on this thread last year, I was able to get this to work... but for some reason, now, I keep getting an error saying
unknown tag "news"
I have the exact same code as last time (except for the replacement), but for some reason it doesn't like the "news" tag...
Code: Select all
{news number=1000 detailpage='Detail' assign='newspages'}
{foreach from=$items item=entry}
<url>
<loc>{$entry->moreurl}</loc>
<lastmod>{$entry->postdate|date_format:"%Y-%m-%d"}</lastmod>
<priority>{$page->priority}</priority>
<changefreq>{$page->frequency}</changefreq>
</url>
{/foreach}
Any thoughts anyone?
ERROR DISPLAYED
Code: Select all
ERROR: at line 709 in file /home/content/43/11408043/html/lib/smarty/sysplugins/smarty_internal_templatecompilerbase.php:
Message:
Syntax Error in template "module_db_tpl:SiteMapMadeSimple;xml_Main" on line 17 "{news number=1000 detailpage='Detail' assign='newspages}" unknown tag "news"
Nope, I also tried the old cms_module calling... but doesn't work
Code: Select all
{cms_module module='news' detailpage='new_page'....
...tried the original example offered with capture, but still nothing
Re: SiteMapMadeSimple with CGBlog- and/or News-Module?
Posted: Mon Oct 28, 2013 6:37 pm
by calguy1000
The module name is News not news
{news} is a shortcut we added for backwards compatibility, but probably does not work from the admin interface.
{cms_module module=News} should work.
Re: SiteMapMadeSimple with CGBlog- and/or News-Module?
Posted: Mon Oct 28, 2013 6:40 pm
by Rolf
fearmydesign wrote:Syntax Error in template "module_db_tpl:SiteMapMadeSimple;xml_Main" on line 17 "{news number=1000 detailpage='Detail' assign='newspages}" unknown tag "news"
{news number=1000 detailpage='Detail' assign='newspages
'} <- Note missing tag