Page 1 of 1

advanced sitemap

Posted: Tue Oct 21, 2008 8:27 am
by antiheld2000
Hi,

wouldn't it be nice, if there would be a optional parameter for the sitemap tag, which tells the tag to look after a meta description for the content. if there is a desciption: print it right below the title of the menupoint. i think this would be a benefit for many sitemaps. what do you think?

regards
anti

Re: advanced sitemap

Posted: Tue Oct 21, 2008 12:01 pm
by nhaack
Hi Antiheld2000,

you could try out the content_dump plug-in. Sorting by hierarchy will allow you to list the pages in the correct order and you can access specific content blocks (e.g. an additional block called description). However, you can not use it to access the meta-data at the moment.

Alternatively, I guess with the CGSimple module (I think that was its name), you could also achieve something like you want.

I think the hardest part is to parse the meta-data and check for a description and use that (I do not know if if the CGSimple can do that).

Since I am a lazy guy, I use a content-block called "meta-description" on my page-templates and use that field in the template in the head-area. That way, the meta description is stored as a content-prop and I could use it easier. Don't know if that would be a solution for you.

I think the sitemap as described would be a great feature. I might consider to implement it in a new version of the content_dump plug-in (meta-data parsing)... but it would take a little time...

Best
Nils

Re: advanced sitemap

Posted: Tue Oct 21, 2008 3:37 pm
by antiheld2000
thanks for your answer. i would like to see this as a optional feature in the future. i tried it myself with some code snippets from php.net, but it doesn't work properly. i don't know if this is the right forum and wether the interest for this is big enough but i post my tryings:

i'm getting the meta-data in pluginsfunction.sitemap.php right behind line number 179 with this code (works great):

Code: Select all

$html = my_htmlentities($onecontent->Metadata());
right behind that i try to figure out the essential data i want with this code:

Code: Select all

preg_match_all("|<meta[^>]+name=\"([^\"]*)\"[^>]+content=\"([^\"]*)\"[^>]+>|i",$html,$out,PREG_PATTERN_ORDER);

for ($i=0;$i < count($out[1]);$i++) {
	if (strtolower($out[1][$i]) == "description") $meta['description'] = $out[2][$i];
}
and parse it to the $menu variable to print it out:

Code: Select all

$menu .= '<br />' . my_htmlentities($onecontent->Metadata()) . '<br />';
but unfortunately it doesn't work right. i think the regular expression is'nt correctly working. does anybody see the fault?

Re: advanced sitemap

Posted: Wed Oct 22, 2008 7:28 am
by Russ
Use {description}?

Re: advanced sitemap

Posted: Wed Oct 22, 2008 7:30 am
by antiheld2000
Russ wrote: Use {description}?
in the sitemap plugin?

Re: advanced sitemap

Posted: Wed Oct 22, 2008 9:50 am
by Russ
Apologies antiheld2000, I should have had a coffee and woken up before posting !