SiteMapMadeSimple with CGBlog- and/or News-Module?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
User avatar
imeos
New Member
New Member
Posts: 4
Joined: Thu Jul 30, 2009 5:20 am

SiteMapMadeSimple with CGBlog- and/or News-Module?

Post 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.
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: SiteMapMadeSimple with CGBlog- and/or News-Module?

Post 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
nockenfell
Power Poster
Power Poster
Posts: 751
Joined: Fri Sep 12, 2008 2:34 pm

Re: SiteMapMadeSimple with CGBlog- and/or News-Module?

Post 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.
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: SiteMapMadeSimple with CGBlog- and/or News-Module?

Post 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}
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: SiteMapMadeSimple with CGBlog- and/or News-Module?

Post by calguy1000 »

a: why not use the 'assign' parameter to news (it works by default for all module calls, and is faster than captur):

Code: Select all

{news number=1000 assign='junk'}
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'}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: SiteMapMadeSimple with CGBlog- and/or News-Module?

Post 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.
Bilmartech
Forum Members
Forum Members
Posts: 50
Joined: Mon Feb 21, 2011 2:08 am

Re: SiteMapMadeSimple with CGBlog- and/or News-Module?

Post 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?
User avatar
fearmydesign
Power Poster
Power Poster
Posts: 363
Joined: Sun Feb 28, 2010 10:54 pm

Worked Perfect!... quick question

Post 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}
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm

Re: SiteMapMadeSimple with CGBlog- and/or News-Module?

Post by Jos »

that would be the page id of your detailpage "news-detail"
User avatar
myleen99
Forum Members
Forum Members
Posts: 23
Joined: Tue Jul 27, 2010 3:07 pm

Re: SiteMapMadeSimple with CGBlog and News-Module?

Post 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.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: SiteMapMadeSimple with CGBlog- and/or News-Module?

Post by Rolf »

You did chnage a page to set an event te recreate the sitemap?
What is your system information?

Grtz. Rolf
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
myleen99
Forum Members
Forum Members
Posts: 23
Joined: Tue Jul 27, 2010 3:07 pm

Re: [SOLVED] SiteMapMadeSimple with CGBlog- and/or News-Modu

Post 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.
User avatar
fearmydesign
Power Poster
Power Poster
Posts: 363
Joined: Sun Feb 28, 2010 10:54 pm

Re: SiteMapMadeSimple with CGBlog- and/or News-Module?

Post 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

Code: Select all

{capture assign='junk'}...
Rod
"Be careful who you step on your way up; because you never know who you'll meet on your way down!" - or something like that.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: SiteMapMadeSimple with CGBlog- and/or News-Module?

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: SiteMapMadeSimple with CGBlog- and/or News-Module?

Post 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
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Post Reply

Return to “Modules/Add-Ons”