Textpattern CMS support forum

You are not logged in. Register | Login | Help

#161 2019-06-16 03:41:35

peterj
Member
From: Melbourne, Australia
Registered: 2005-06-02
Posts: 35

Re: rah_sitemap

Thanks etc, this is what worked for me in the end, around line 209.

if (!get_pref('rah_sitemap_expired_articles')) { $sql[] = "(Expires IS NULL OR Expires = '' OR Expires >= now())"; }

Offline

#162 2019-06-22 05:27:52

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,488
Website

Re: rah_sitemap

Looks like gocom added a fix for this on GitHub. I updated the compiled plugin here accordingly.


TXP Builders – finely-crafted code, design and txp

Offline

#163 2019-06-24 00:27:34

peterj
Member
From: Melbourne, Australia
Registered: 2005-06-02
Posts: 35

Re: rah_sitemap

Thanks Jakob & Gocom for the updates.

To get it to work for individual articles, when excluding expired articles, I had to change Expires = NULL to Expires IS NULL

Offline

#164 2019-07-04 01:23:52

peterj
Member
From: Melbourne, Australia
Registered: 2005-06-02
Posts: 35

Re: rah_sitemap

A couple of other things spotted while working with this plugin – unfortunately unable to resolve either. TXP 4.7.2, PHP 7.2.

1. Clicking Sections > Default brings up this message:
Fatal error: Uncaught TypeError: Return value of Rah_Sitemap::renderSectionOptions() must be of the type string, none returned in /home/abcd/public_html/textpattern/lib/txplib_misc.php(1870) : eval()'d code:354 Stack trace: #0 /home/abcd/public_html/textpattern/lib/txplib_misc.php(1989): Rah_Sitemap->renderSectionOptions('section_ui', 'extend_detail_f...', '', Array) #1 /home/abcd/public_html/textpattern/lib/txplib_misc.php(2189): callback_event('section_ui', 'extend_detail_f...', 0, '', Array) #2 /home/abcd/public_html/textpattern/include/txp_section.php(590): pluggable_ui('section_ui', 'extend_detail_f...', '', Array) #3 /home/abcd/public_html/textpattern/include/txp_section.php(58): section_edit() #4 /home/abcd/public_html/textpattern/index.php(255): include('/home/abcd/...') #5 {main} thrown in /home/abcd/public_html/textpattern/lib/txplib_misc.php(1870) : eval()'d code on line 354

2. If a change is made to include in section/category, the new value saves, but when the category or section is returned to the “included in” radios are both unchecked.

Both issues trace back to the same functions renderSectionOptions and renderCategoryOptions. I’m guessing the first issue might be dealt with by returning false rather than returning nothing?

Offline

#165 2019-07-11 20:13:21

hilaryaq
Plugin Author
Registered: 2006-08-20
Posts: 196
Website

Re: rah_sitemap

peterj wrote #318634:

A couple of other things spotted while working with this plugin – unfortunately unable to resolve either. TXP 4.7.2, PHP 7.2.

1. Clicking Sections > Default brings up this message:
Fatal error: Uncaught TypeError: Return value of Rah_Sitemap::renderSectionOptions() must be of the type string, none returned in /home/abcd/public_html/textpattern/lib/txplib_misc.php(1870) : eval()'d code:354 Stack trace: #0 /home/abcd/public_html/textpattern/lib/txplib_misc.php(1989): Rah_Sitemap->renderSectionOptions('section_ui', 'extend_detail_f...', '', Array) #1 /home/abcd/public_html/textpattern/lib/txplib_misc.php(2189): callback_event('section_ui', 'extend_detail_f...', 0, '', Array) #2 /home/abcd/public_html/textpattern/include/txp_section.php(590): pluggable_ui('section_ui', 'extend_detail_f...', '', Array) #3 /home/abcd/public_html/textpattern/include/txp_section.php(58): section_edit() #4 /home/abcd/public_html/textpattern/index.php(255): include('/home/abcd/...') #5 {main} thrown in /home/abcd/public_html/textpattern/lib/txplib_misc.php(1870) : eval()'d code on line 354

2. If a change is made to include in section/category, the new value saves, but when the category or section is returned to the “included in” radios are both unchecked.

Both issues trace back to the same functions renderSectionOptions and renderCategoryOptions. I’m guessing the first issue might be dealt with by returning false rather than returning nothing?

Hi Peter! I found the best solution for the most modern txp/php setup is to do it natively as was mentioned in the forum not sure where!

Create a presentation>pages called xml_sitemap

Insert the below, tweak for your own site:

<?xml version="1.0" encoding="UTF-8"?><txp:header value="application/xml; charset=utf-8" />
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
<txp:section_list break="" exclude="sitemap,404,articles">
<url>
    <loc><txp:section url="1" /></loc>
<txp:evaluate test="article_custom">
    <lastmod><txp:article_custom section='<txp:section />' limit="1" sort="LastMod desc"><txp:modified format="%Y-%m-%d" /></txp:article_custom></lastmod>
</txp:evaluate>
</url>
</txp:section_list>
<txp:article_custom section="blog" limit="9999">
<url>
    <loc><txp:permlink /></loc>
    <lastmod><txp:modified format="%Y-%m-%d" /></lastmod>
</url>
</txp:article_custom>
</urlset>

Create a section called sitemap that uses the page xml_sitemap, now visit yoururl.com/sitemap and you should see a list of section pages plus any individual article urls (I have put blog as the section name but any section that features multiple articles can be here).

Now you can submit that url /sitemap to google search console, which I can confirm is tested and working. :)


…………………
I <3 txp
…………………

Offline

#166 2019-07-11 20:16:59

hilaryaq
Plugin Author
Registered: 2006-08-20
Posts: 196
Website

Re: rah_sitemap

colak wrote #318212:

This is no longer needed. You can create a new section called mysitemap and include the following template which can be linked:

<?xml version="1.0" encoding="UTF-8"?>...

You will be able to reach the sitemap on yoursite.tld/mysitemap/. Do amend to your needs and hopefully the community will correct any errors I have made.

Thanks Yiannis who pointed me in the right direction! The best tip.


…………………
I <3 txp
…………………

Offline

#167 2019-07-15 08:51:31

Gallex
Member
Registered: 2006-10-08
Posts: 1,132

Re: rah_sitemap

I would like to exclude some sections from sitemap, but NO option won’t activate if i edit section. am i only one with such issue? same problem in many sites actually.

TXP 4.7.3, PHP 7.2.19, rah_sitemap 2.0.1

Online

#168 2019-07-15 12:21:01

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,296
Website

Re: rah_sitemap

Hi Gallex, Is there a reason you are not using the native way?


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

#169 2019-07-16 08:26:10

Gallex
Member
Registered: 2006-10-08
Posts: 1,132

Re: rah_sitemap

colak wrote #318728:

Hi Gallex, Is there a reason you are not using the native way?

not dynamic, more handwork – looks to me at first glance… but i will give a try in smaller sites.

Online

#170 2019-07-16 10:23:38

Gallex
Member
Registered: 2006-10-08
Posts: 1,132

Re: rah_sitemap

colak wrote #318212:

This is no longer needed. You can create a new section called mysitemap and include the following template which can be linked:

<?xml version="1.0" encoding="UTF-8"?>...

You will be able to reach the sitemap on yoursite.tld/mysitemap/. Do amend to your needs and hopefully the community will correct any errors I have made.

did like you suggested, here is my result – must it look like that?

my page:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url><loc><txp:site_url /></loc></url>
<txp:section_list exclude="sitemap,muu,various,test,otsing">
<url><loc><txp:site_url /><txp:section />/</loc></url>
</txp:section_list>
<txp:article_custom section="veebidisain,portfolio,kontaktid,hobuvankrid" break="url" wraptag="" limit="9999">
<loc><txp:permlink /></loc>
<lastmod><txp:modified format="%Y-%m-%dT%H:%M:%SZ" /></lastmod>
</txp:article_custom>
</urlset>

Last edited by Gallex (2019-07-16 11:38:14)

Online

Board footer

Powered by FluxBB