Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2019-01-06 17:38:55

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

Re: Next and Prev article Question

Your code should actually work but tested it and indeed it does not as the variables seem to be throwing false positives. I also tried the more efficient.

<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 />
<link rel="prev" href="<txp:variable name="next" />">
</txp:if_variable>
<txp:if_variable name="next" value="">
<txp:else />
<link rel="next" href="<txp:variable name="prev" />">
</txp:if_variable>
</txp:if_article_list>
.....
</head>

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

Offline

#12 2019-01-06 17:44:42

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

Re: Next and Prev article Question

Did you try?

<txp:if_article_list>
<txp:evaluate test="older, newer">
<link rel="prev" href="<txp:older />">
<link rel="next" href="<txp:newer />">
</txp:evaluate>
</txp:if_article_list>

> Edit: This does not seem to be work either:( There seems to be a bug somewhere in the older newer tags which should be reported in the Core development forum.

> Edit 2. Reported it on github.

Last edited by colak (2019-01-06 19:53:34)


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

Offline

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

etc
Developer
Registered: 2010-11-11
Posts: 3,127
Website

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>

etc_[ query | search | pagination | date | tree | cache ]

Offline

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

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

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: 7,156
Website

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.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

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

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

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: 3,127
Website

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.


etc_[ query | search | pagination | date | tree | cache ]

Offline

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

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

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: 3,127
Website

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="<+>" />' />

etc_[ query | search | pagination | date | tree | cache ]

Offline

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

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

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

Board footer

Powered by FluxBB