Recent Topics

XML Sitemap exporter

Started by on Oct 01, 2013 – Contents updated: Nov 16, 2018

Oct 01, 2013 21:18    

I was wondering if the B2Evolution develop team would consider adding a functionality which will generate xml sitemaps?

May 19, 2014 14:31

When I run sitemap_blogs.php in 5.0.8 all I get is:

Code

This XML file does not appear to have any style information associated with it. The document tree is shown below.
      <urlset></urlset>

jj.

May 20, 2014 05:31

@jibberjab please note that this feature works with the blog 1 by default, and that only published content (posts set as "Public") will be included in the XML file. The only way that I found to get a result like yours was setting all the post to a status different than "Public".

Could you please double-check that?

Regards!

May 20, 2014 20:02

So it won't work if blog 1 is disabled? I need some way to generate sitemaps for the site but I haven't been using blog1 and not sure how to enable it.. I tried enabling it as an aggregator for blog 2,3,5 (which are the only active active blogs on the system) and it kept redirecting straight to blog 2 instead.

jj.

May 20, 2014 21:56

@jibberjab all right, I mentioned blog 1 because it is set by default in sitemap_a.php and sitemap_blogs.php, but it could be any of the others. Just define which of the collections do you want to generate the sitemap and replace the value of the variable $blog in any of the mentioned files. Or just duplicate sitemap_a.php and name it sitemap_b.php, it doesn't matter the name of the file, at the end, they are simple stub files that use a particular skin; _sitemap in this case.

This page could be useful if you need more information about aggregation: http://b2evolution.net/man/collection-aggregation-settings.

A use case could be to create a new empty collection, lets say that its ID is 6, so aggregate the 2,3 and 5 colls using the feature linked before. Now, duplicate the sitemap stub file, name it just sitemap.php and set the value of $blog to 6. That way, you will have a sitemap of your entire site.

Regards!

May 20, 2014 23:19

Yup, I already did some messing around with that during my lunch break. (Thanks for the link) I was able to create an aggregate blog on blog 1.. so:

domain.com/ <--blog 1 via stub "all.php" relative to baseurl / (right now hidden from blog list)
domain.com/main/ <-- blog 2 via stub2.php rel to baseurl /main/
domain.com/projects/ <--blog 3 via stub3.php rel to baseurl /projects/
domain.com/acura_itx/ <-- blog 5 via stub5.php rel to baseurl /acura_itx/

I'm still debating moving/emptying all the posts and cats from 2,3,5 into 1, and then 301 redirecting all the old locations via htaccess... I'm torn between the minimalism of everything under a single blog, and my OCD telling me that each main "branch" should be in its own actual branch. The overriding concern is broken links or something going wrong after merging 3 collections into 1 "new" collection. If I were sure that all the old domain.com/stub/title-of-post could be redirected simply to domain.com/title-of-post (basically just remove stubnames) I might go ahead and do it, and then as you suggest place a domain.com/sitemap/ stub as blog 6 or something.

I'm pretty sure I don't want to keep the aggregate blog1 running visibly alongside the blogs it aggregates, because then in the main blog view you have duplicated content on the same domain.. The aggregate blog view is going to show the same post content (above the MORE link) that exist on other blogs on the same system.. that could be bad.. So it's either stay with 3 separate blogs or merge them into a single blog and remove the 3.

I think I'm not yet clear on whether I would leave 2,3,5 intact even after emptying them, or if they could be deleted or reused for something else.

(just thinking aloud)

jj.

Nov 13, 2018 08:27

Hi all
I don't know exactly what it means when when it says 'run' the file ?
What I did, was to put this (http://www.example.com/sitemap_blogs.php) into my webbrowser.
(after having placed the file in my b2evolution root folder)
And I got this (what I want is a XML sitemap for google console):

Nov 13, 2018 11:37

Not clear what you are saying and it's an old thread so it may be better to start afresh with version, full screen view including URL. Nor clear on what you refer to with "when it says 'run' the file ?"

Nov 13, 2018 13:52

Ok I'll begin fresh:

B2evolution version 6.10.2

  • I want to create a sitemap which I can upload to my b2evolution root, which google console can access.
  • I guess I can either update it manually from time to time, or it can be a 'script'-type (dont know so much about it) which automatically generates a sitemap when google or some other search-engine accesses it.

Now on this manual page:
http://b2evolution.net/man/advanced-topics/how-to/make-a-site-map
there is a downloadable file called sitemap_blogs.txt which is supposed to be renamed to sitemap_blogs.php and put in the b2evlution root folder.

Then on this thread it says:


#4 jibberjab May 19, 2014 14:31
When I run sitemap_blogs.php in 5.0.8 all I get is:
Code

1: This XML file does not appear to have any style information associated with it. The document tree is shown below.
2:     <urlset></urlset>

jj.


I didn't know what jibberjab meant by run, but calling the via the browser was the only thing I could think of.
It gives me the following which I dont know what to do with:

Nov 13, 2018 14:05

Hi.
When I said start anew I meant new thread given the age and hence version that was in the initial discussion :)

I'll try and implement the 'sitemap' dodah and respond

Nov 13, 2018 14:58

6.10.3 /sitemap_blogs.php
The file has be in the root or where you direct the $baseurl

The file is a stub so needs a blog number and then there is the skin override $tempskin which has no formatting
You can comment out $tempskin if you like and then you should just get your blog as defined by the number, so you know the file works. Make sure you have the /skins/_sitemap too :)

I have to set $blog=5 for example as I don't have blog=1 :: see www.calstock.org.uk/sitemap_elf.php

Setting $blog=16 for example gives :: www.calstock.org.uk/sitemap_vow.php

Output shown without formatting.

is this not what you get or want?

Though above I have only accessed content of a single blog with each sitemap file

Nov 13, 2018 16:04

Yup, this was what I expected to see.
Much appreciated Amoun.
I'm sure I'll get it working with this info

Nov 13, 2018 16:07

Doesn't look like you have the file in the root.
You know it can be called anything [/sitemap.php] would do.

Nov 13, 2018 16:19

its not there right now, just deleted it, putting a new one :-D

Nov 13, 2018 16:25

By the way Amoun. Do you know if google console will work on several sitemap files, or will it just use the latest one you have specified ?
(if yes I could keep one for each blog sitemap1.php sitemap2.php etc.)
(there is a list of all the sitemap files which has been uploaded in the user interface)

Nov 13, 2018 17:33

By the way, one problem with picking up on an old thread is that apart from version issues that won't work it's likely that the author of the topic is emailed at every comment, where as far as they are concerned the issue has been resolved years ago :(

Nov 14, 2018 08:50

(have seen your comment about original author receiving mails, will start new thread next time)
but let me finish this if I can.

It's not working:
I keep the blog number as 1, because I have a blog 1
The blog loads as usual if I out-comment the $tempskin line.
But:
If I don't outcomment $tempskin then I get the screenshot from above (the one with "404 Not Found")
The file is in the root.

I dont know whats wrong ?

Nov 14, 2018 09:09

Update about having _sitemap skin or not:

I have the files:
/public_html/skins/_sitemap/_skin.class.php
/public_html/skins/_sitemap/index.main.php

Note: The stub file is in:
/public_html/sitemap_blogs.php

Nov 14, 2018 14:19

You may have a redirect somewhere rather than anything wrong with what you are doing or the [sitemap_blogs.php] file.

You can try changing the $tempskin and see if that confirms the file is being read and the error that the url cannot be found must mean it is looking in the wrong place, hence the redirect thinking.

Have you made changes to the $baseurl, which may now be lodged in the database.

If you think it may be a redirect check the [conf/*.*] files and the database.

Nov 14, 2018 15:13

I tried renaming the _tempskin folder to _tempskinXX
That gives the same result, so I guess you are right, it doens't read the skinfiles.
But it does read the sitemap_blogs.php, so where does it think the skins folder are ? hmm

I can't see anything wrong in the _basic_config.php

$baseurl = 'https://www.spiritwalkabout.com/';
// Use the following if you want to use the current domain:
if( isset($_SERVER['HTTP_HOST']) )
{ // This only works if HOST is provided by webserver (i-e DOES NOT WORK IN PHP CLI MODE)

$baseurl = ( (isset($_SERVER['HTTPS']) && ( $_SERVER['HTTPS'] != 'off' ) ) ?'https://':'http://')
                        .$_SERVER['HTTP_HOST'].'/';

}

However www.spiritwalkabout.com used to be just a domain alias, but now it has its own webhotel, so perhaps there is something in the database, which I had to export and import.

Nov 14, 2018 15:14

wow didnt intend those big letters

Nov 14, 2018 15:19

do I look manually in the database ?
if yes, any hint on which table ?

Nov 14, 2018 18:19

Hi

@amoun
You can try changing the $tempskin and see if that confirms the file is being read and the error that the url cannot be found must mean it is looking in the wrong place, hence the redirect thinking.

I meant edit $tempskin='another_skin' to if the site changes

@jan_kirk
That gives the same result, so I guess you are right, it doens't read the skinfiles.

But if you're happy the file exists and is being executed no need mess, just have to find why variable being ignored.

table evo_blogs lists the blogs and by trying to edit any you can see if each has the correct
blog_access_type
and
blog-siteurl

Nov 14, 2018 18:31

Have you tried starting from basics. Call it ?? [skin_test.php] and see what you get with spiritwalkabout.com/skin_test.php

Make a stub file you know works and see if you can access any other skin.
https://b2evolution.net/man/stub-file

<?php

# Select which blog you want to display here!
# You can find these numbers in the back-office under the Blogs section.
$blog = 1;

# Force a specific skin here with this setting: (otherwise, default will be used)
# Change the skin 'basic' to one you actually have
$skin = 'basic';

/**
 * Note: if you put this file in a subdirectory, you will need to adjust the path below, for example:
 * require_once dirname(__FILE__).'/../conf/_config.php';
 */
require_once dirname(__FILE__).'/conf/_config.php';
require $inc_path.'_blog_main.inc.php';
?>

Nov 15, 2018 07:45

Hi Amoun

I can load another skin with the following stub in root, for example:

<?php
$blog = 1;
$tempskin = 'stain_skin';
require_once dirname(FILE).'/conf/_config.php';
require $inc_path.'_blog_main.inc.php';
?>

Note: If I write $skin='XXXXXX' instead of $tempskin='XXXXXX' then the normal skin will load.
If I use $tempskin='_sitemap', then the page with '404 Not Found' loads. (I checked in backoffice that _sitemap skin is showing as installed).

Here are 2 screenshots to do with url, perhaps they will tell you something. I was wondering about the variable (blog_http_protocol) ?

Any help greatly appreciated, thanks.

Nov 15, 2018 13:24

I seem to have lost two posts to you ??

Ok I've just spent a few hours on this and am getting a bit bogged down :)

I seem to have a strange issue that if I use a stub file like [elf.php] ( and [misc.php]) etc in the root

So I have this code in [misc.php]

<?php
$blog = 18;
$skin ='_sitemap';
require_once dirname(__FILE__).'/conf/_config.php';
require $inc_path.'_blog_main.inc.php';
?>

Which works fine I get the sitemap and I can change the $skin
But it does not work with the other file called [sitemap_misc.php]
In this second file no matter what the $skin is set to I get the sitemap?? even if there is no such parameter

<?php
$blog = 18;
require_once dirname(__FILE__).'/conf/_config.php';
require $inc_path.'_blog_main.inc.php';
?>

So whatever name I use I get directed to [misc.php] where I can chose the skin, maybe as that is where my url is set.
If I set my proper stub file [misc.php] back to my proper site

Basically I'm getting nowhere and need a break :) lol

Nov 15, 2018 14:42

Just a quick note:
I found that I had to clear the browser cache (guess some setting can just be set to 'reload every time') every time my normal page had been shown.
But I have still not succeeded in getting that sitemap output even 1ce :(

Appreciate your efforts though


Form is loading...

Website builder – This forum is powered by b2evolution CMS, a complete engine for your website.