Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2019-01-06 19:59:48

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

Re: Next and Prev article Question

Difficult to say whether this is a bug or a feature. You can try the following:

<txp:newer><link rel="prev" href="<txp:newer />"></txp:newer>
<txp:older><link rel="next" href="<txp:older />"></txp:older>

Offline

#14 2019-01-06 20:03:44

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

Re: Next and Prev article Question

Just saw

Tried

Same mistake <link rel="next" href=""> and <link rel="prev" href="">

Tried so

<txp:etc_pagination wraptag=""  	
    prev='<link rel="prev" href="https://site.com{href}" />,'
    next='<link rel="next" href="https://site.com{href}" />,'
    link=',<link rel="canonical" href="https://site.com{href}" />'
    mask='{prev}{links}{next}'
    />	

Inside <head> do not work too.

Outside <head> it works

textpattern v4.7.2


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

Offline

#15 2019-01-06 20:15:40

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

Re: Next and Prev article Question

Hmmm…Maybe it has nothing to do with the head and more about it being outside the article context. Try…

<txp:if_article_list>
<txp:article>
<txp:newer><link rel="prev" href="<txp:newer />"></txp:newer>
<txp:older><link rel="next" href="<txp:older />"></txp:older>
</txp:article>
</txp:if_article_list>

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

Offline

#16 2019-01-06 20:19:36

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

Re: Next and Prev article Question

Tried it

<txp:newer><link rel="prev" href="<txp:newer />"></txp:newer>
<txp:older><link rel="next" href="<txp:older />"></txp:older>

Inside <head> do not work too.

Outside <head> </head> it works

<a href="https://site.com/section/"><link rel="prev" href="https://site.com/section/"></a>
<a href="https://site.com/section/?pg=3"><link rel="next" href="https://site.com/section/?pg=3"></a>

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

Offline

#17 2019-01-06 20:29:04

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

Re: Next and Prev article Question

Ah, right, it wraps it in a tags. Well, then out the tank:

<txp:hide process="2">
<txp:evaluate><link rel="prev" href="<txp:older />"></txp:evaluate>
<txp:evaluate><link rel="next" href="<txp:newer />"></txp:evaluate>
</txp:hide>

Edit: or you can include <txp:article pgonly /> (with the same limit attribute that the main <txp:article /> tag) before your newer/older links block.

Offline

#18 2019-01-06 22:07:14

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

Re: Next and Prev article Question

That is all!

Everything is working.

I spent two days looking for a way

Magician fakir shaman Oleg invented and launched

Thanks Oleg!

Thanks colak!


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

Offline

#19 2019-01-07 07:24:12

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

Re: Next and Prev article Question

Cerise sur le gâteau :

<txp:older wraptag='<link rel="prev" href="<+>" />' />
<txp:newer wraptag='<link rel="next" href="<+>" />' />

Offline

#20 2019-01-07 15:13:34

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: Next and Prev article Question

Without having a chance to test:

<head>
....
<txp:if_article_list>
<txp:variable name="prev" value='<txp:newer />' />
<txp:variable name="next" value='<txp:older />' />
<txp:if_variable name="prev" value="">
<txp:else />
<txp:evaluate test="newer">
<link rel="prev" href="<txp:newer />">
</txp:evaluate>
</txp:if_variable>
<txp:if_variable name="next" value="">
<txp:else />
<txp:evaluate test="older">
<link rel="next" href="<txp:older />">
</txp:evaluate>
</txp:if_variable>
</txp:if_article_list>
.....
</head>

Offline

#21 2019-01-07 15:49:35

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

Re: Next and Prev article Question

Hi Michael, and happy new year.

Nope. Weirdly enough the standard ways do not work outside the article context. Check the thread. Oleg’s solution though is so wonderfully minimal there is no reason to add more lines of code.


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

Offline

#22 2019-01-07 16:47:46

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: Next and Prev article Question

Thanks, Colak. and Happy New Year to you.

Somehow I didn’t see all the other replies.

Offline

#23 2019-01-07 17:18:56

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

Re: Next and Prev article Question

For the background, the pagination data required by newer/older is set by <txp:article /> tag. Since here we need newer/older tags to be output before <txp:article /> is processed, the “standard” ways can not work. Their behaviour though in this case is different in 4.6 and 4.7:

  • in 4.6, <txp:newer /> outputs nothing;
  • in 4.7, it outputs itself (i.e. <txp:newer /> with eventual attributes) in hope that on the second parser pass the data will be available after encountering a <txp:article /> on the first pass.

Now I leave it with you to explain which result your code will produce in 4.6 and in 4.7 :-)

Offline

Board footer

Powered by FluxBB