Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-04-13 10:01:30

Summer
Member
Registered: 2018-01-29
Posts: 60

Sticky article does not show content

The sticky article list can be displayed, but click to enter the content page without displaying the content? What is the problem?

Offline

#2 2018-04-13 10:06:54

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

Re: Sticky article does not show content

Hi could you please tell us what code you are using and in which context the sticky is not showing? (ie on the front page, on an individual article, category page etc)


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

Offline

#3 2018-04-13 10:40:01

Summer
Member
Registered: 2018-01-29
Posts: 60

Re: Sticky article does not show content

colak wrote #310990:

Use

<txp:article_custom sort =“Posted desc”status =“sticky”limit =“3”> 
<a target="_blank" href="<txp:permlink />"><txp:title /></a>
</txp:article_custom>

on the home page。

EDIT: Textile — Uli

Last edited by uli (2018-04-13 10:55:46)

Offline

#4 2018-04-13 10:44:23

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

Re: Sticky article does not show content

There seem to be spaces which shouldn’t be there. Try.

<txp:article_custom sort ="Posted desc" status="sticky" limit ="3"> 
<a target="_blank" href="<txp:permlink />"><txp:title /></a>
</txp:article_custom>

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

Offline

#5 2018-04-13 11:04:23

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,305

Re: Sticky article does not show content

Summer, it seems like you copied code that was not displayed as code, i.e. not from inside pre or code tags. This forum (and most of the websites around Textpattern as a topic) converts straight quotes to curly ones by applying textile to “normal” text, like your own TXP website does.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#6 2018-04-13 11:25:14

Summer
Member
Registered: 2018-01-29
Posts: 60

Re: Sticky article does not show content

<txp:article_custom sort=“Posted desc” status=“sticky” limit=“3”>
I use this tag to output the sticky article list correctly.
But clicking on the title of the article to enter the page is an empty page.
My question is why the sticky article is an empty page. How to solve?

Offline

#7 2018-04-13 11:28:17

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,305

Re: Sticky article does not show content

There’s another potential problem with your code: <txp:title /> might lead to URLs that aren’t properly encoded. You’d better use <txp:article_url_title />. Strike that.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#8 2018-04-13 11:50:43

Summer
Member
Registered: 2018-01-29
Posts: 60

Re: Sticky article does not show content

uli wrote #311001:

There’s another potential problem with your code: <txp:title /> might lead to URLs that aren’t properly encoded. You’d better use <txp:article_url_title />.

http://text.local/articles/text1
This is the generated link. The live article status can display the article content, but the sticky article does not display the content.

Offline

#9 2018-04-13 12:21:16

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

Re: Sticky article does not show content

Summer wrote #311003:

http://text.local/articles/text1
This is the generated link. The live article status can display the article content, but the sticky article does not display the content.

This could be because you are not using the sticky identifier in the article tag.

We have to know more about how you are using the tags but try.

<txp:article status="sticky" /> in the section where sticky articles are saved.


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

Offline

#10 2018-04-13 13:21:19

Summer
Member
Registered: 2018-01-29
Posts: 60

Re: Sticky article does not show content

colak wrote #311004:

Copy and paste to the default article page, the front desk did not happen anything ~

Offline

#11 2018-04-13 13:33:53

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,611
Website

Re: Sticky article does not show content

Yiannis is right. On your list view you have <txp:article_custom status="sticky" limit="3" /> but on your individual article page you also need status="sticky".

The trick is to use the txp:article tag twice – once for status=sticky and once for status=live. Something like this:

<txp:if_article_list>

    <!-- article list page -->
    <txp:article_custom sort="Posted desc" status="sticky" limit="3"> 
        <a target="_blank" href="<txp:permlink />"><txp:title /></a>
    </txp:article_custom>

<txp:else />

    <!-- individual article page -->
    <txp:article status="sticky" />
    <txp:article status="live" />

</txp:if_article_list>

You don’t strictly need status="live" as that is the default, but it illustrates the principle. As the live and sticky cases are mutually exclusive, only one or the other will ever apply.


TXP Builders – finely-crafted code, design and txp

Offline

#12 2018-04-13 14:23:51

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

Re: Sticky article does not show content

A couple of questions to help us diagnose

  • What section are the articles assigned to (you can find that in the write tab).
  • What page does the section use (you can find that in Presentation>Sections)

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