Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#157 2019-05-26 10:39:21

singaz
Member
Registered: 2017-03-12
Posts: 150

Re: rah_sitemap

Here we made the sitemap better. Displays article creation time.


Sorry my horror English. I’m learning textpattern, I’m learning English

Offline

#158 2019-06-04 10:50:01

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

Re: rah_sitemap

A bit late, but thanks @Jakob, your help on May 21 did the trick!

Offline

#159 2019-06-14 05:20:20

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

Re: rah_sitemap

I think I’ve worked out the issue with this plugin not displaying articles. If you select “yes” for the sitemaps preference: “Include expired articles?”, the articles all appear in the sitemap.

Perhaps an empty expired field in an article is interpreted as zero, so would prevent any article from appearing in the sitemap?

Offline

#160 2019-06-14 08:45:39

etc
Developer
Registered: 2010-11-11
Posts: 5,187
Website GitHub

Re: rah_sitemap

peterj wrote #318473:

I think I’ve worked out the issue with this plugin not displaying articles. If you select “yes” for the sitemaps preference: “Include expired articles?”, the articles all appear in the sitemap.

Perhaps an empty expired field in an article is interpreted as zero, so would prevent any article from appearing in the sitemap?

It looks like NULLDATETIME constant used in rah_sitemap has been dropped and replaced by NULL in txp db queries. Try to replace

Expires = ".NULLDATETIME."

with

Expires = NULL

in rah_sitemap code.

Offline

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

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

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: 4,726
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: 99

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: 99

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: 335
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: 335
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,308

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

Offline

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

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: rah_sitemap

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


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB