Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
?pg=
Is there a way to automatically detect the complete list of paginated urls in article_lists?
I’m trying to add those urls in the sitemap.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: ?pg=
I guess this is going to be a factor of the total number of articles and the limit
/ pageby
value you have in your txp:article(_custom) tag.
I know this isn’t the answer you are looking for, but Phil does exactly the opposite in the default theme. This part of the template code sets index
and follow
for the first page only. All other ?pg=x
pages are set to noindex
but also to follow
so that the individual article pages linked to on those pages are found and indexed.
TXP Builders – finely-crafted code, design and txp
Offline
Re: ?pg=
colak wrote #331074:
Is there a way to automatically detect the complete list of paginated urls in article_lists?
I’m trying to add those urls in the sitemap.
<txp:pages total />
I am not sure exactly what you need but my Complex Pagination code might help.
Offline
Re: ?pg=
michaelkpate wrote #331078:
<txp:pages total />...
I am not sure exactly what you need but my Complex Pagination code might help.
Nice! As you say, one would need to iterate over the page url from 1 to total to create the individual page urls, which, in essence, is what a pagination series does.
TXP Builders – finely-crafted code, design and txp
Offline
Re: ?pg=
Hi Michael,
and thanks for your code which admittedly it was the first thing I had a look at. What I am looking for is to produce the results below where all pages from 2 (as ?pg=1 is the same as /blog/) to the last whatever that may be.
<url><loc><txp:site_url />blog/?pg=2</loc></url>
<url><loc><txp:site_url />blog/?pg=3</loc></url>
<url><loc><txp:site_url />blog/?pg=4</loc></url>
...
<url><loc><txp:site_url />blog/?pg=last</loc></url>
I’m sure that there is an easy method for this and I just can’t see it.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#6 2021-07-22 07:40:01
- Myusername
- Member
- Registered: 2019-12-12
- Posts: 162
Re: ?pg=
If you are using a form with the txp:article
tag, you can use txp:older
. For example:
<txp:article pageby="10" pgonly />
<txp:variable name="counter" value="1" />
<txp:older total link="0">
<txp:variable name="counter" value='<txp:evaluate query=''<txp:variable name="counter" /> + 1'' />' />
<loc>pg=<txp:variable name="counter"/></loc>
</txp:older>
Result:
<loc>pg=2</loc>
<loc>pg=3</loc>
<loc>pg=4</loc>
<loc>pg=5</loc>
...
Last edited by Myusername (2021-07-22 07:42:16)
Offline
Re: ?pg=
That is indeed a good idea!
The problem is that I have a section for the sitemap and the article
tag does not recognise the section for which I need the ?pg=#
urls. :(
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: ?pg=
colak wrote #331084:
The problem is that I have a section for the sitemap and the
article
tag does not recognise the section for which I need the?pg=#
urls. :(
In the latest txp <txp:article_custom />
can paginate too:
<txp:section_list>
<txp:page_url context="s" s='<txp:section />'>
<txp:pages total='<txp:article_custom section pgonly limit="2" />' />
<txp:pages total shift link="" break="loc">
<txp:yield item="url" />
</txp:pages>
</txp:page_url>
</txp:section_list>
Offline
Re: ?pg=
Yummy… I’ll test it!
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: ?pg=
colak wrote #331086:
Yummy… I’ll test it!
I did. But it didn’t work.
The adapted code.
<txp:section_list>
<txp:page_url context="s" s="blog">
<txp:pages total='<txp:article_custom section="blog" pgonly limit="2" />' />
<txp:pages total shift link="" break="">
<url><loc><txp:yield item="url" /></loc></url>
</txp:pages>
</txp:page_url>
</txp:section_list>
the result:
<url><loc>https://www.domain.tld/sitemap/</loc></url>
<url><loc>https://www.domain.tld/sitemap/?pg=2</loc></url>
<url><loc>https://www.domain.tld/sitemap/?pg=3</loc></url>
...
ps. The result is the same when I delete context="s"
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Offline
Re: ?pg=
Hi Oleg,
I use it in a page that is called from a section called sitemap and the latest vanilla release.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline