Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-08-03 17:18:29

Amin
New Member
Registered: 2020-08-03
Posts: 7

[SOLVED] Home page

Hi,

I have two problems with home page in textpattern system:

1- how can I assign an article to default page directly? I know that I can build a new category then assign it to default page. I don’t want to add new category because it will be shown on my website. Indeed I don’t like to have duplicate tabs in menu.

2- I would like to keep one article in home page as top article for ever and new articles will be added after that. How can I do it?

Thanks in advance for your help.

Last edited by Amin (2020-08-03 17:18:47)

Offline

#2 2020-08-03 17:37:14

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,269
Website

Re: [SOLVED] Home page

Hi Amin and welcome to txp.

Presentation>pages>default is where the content of the 1st page is coded. You can create a sticky article for it, and call it in that template with <txp:article_custom id="##" form="default" status="sticky" />.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#3 2020-08-03 17:55:33

Amin
New Member
Registered: 2020-08-03
Posts: 7

Re: [SOLVED] Home page

colak wrote #325101:

Hi Amin and welcome to txp.

Presentation>pages>default is where the content of the 1st page is coded. You can create a sticky article for it, and call it in that template with <txp:article_custom id="##" form="default" status="sticky" />.

Thank you so much for reply.

Actually, this is my first experience with textpattern and I used Joomla before. But I found the Textpattern is much better. I’ve followed your instruction. It works very well. But how can I assign new articles to the default page? Default section is not available for assigning in articles. if I build a new section then I have duplicate articles on my website. (I had two issues. Issue 2 solved but Issue 1 remained)

Thanks for your help

Last edited by Amin (2020-08-03 18:12:59)

Offline

#4 2020-08-03 18:15:59

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,269
Website

Re: [SOLVED] Home page

Amin wrote #325102:

Thank you so much for reply.

Actually, this is my first experience with textpattern and I used Joomla before. But I found the Textpattern is much better. I’ve followed your instruction. It works very well yet there is a problem. It will be added to all pages. I just need it for the home page.

Thanks in advance for your help

Are you currently using the default theme?

This is untested but you can try adding the following code in the default page.

<txp:variable name="front" value='<txp:page_url type="0" />' /> 
<txp:if variable name="front">
<txp:article_custom id="##" form="default" status="sticky" />
</txp:if_variable>

If it does not work try changing type="0" to type="1"… I’m sure there is a better way to detect the front page and somebody here will remind us of it:)


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#5 2020-08-03 18:22:09

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,269
Website

Re: [SOLVED] Home page

colak wrote #325103:

Are you currently using the default theme?

This is untested but you can try adding the following code in the default page.

<txp:variable name="front" value='<txp:page_url type="0" />' />...

If it does not work try changing type="0" to type="1"… I’m sure there is a better way to detect the front page and somebody here will remind us of it:)

There is another way! You can use a pageless section. Create another section, and make sure that it does not use any page or css.

Assign the article in that section and then call it. In theory the article will not appear anywhere else except where you call it from. Having said that, I am trying to imagine how your default page looks like in order to advice you properly. If you want, it will be easier if you can copy/paste it here.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#6 2020-08-03 18:23:18

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,721
Website

Re: [SOLVED] Home page

Amin wrote #325102:

Actually, this is my first experience with textpattern and I used Joomla before. But I found the Textpattern is much better.

Yay!

how can I assign new articles to the default page?

You can’t. Not directly. You assign articles to any other section and they appear in their respective sections when you navigate to them. The front page (default) is where you display collections such as lists of articles by one author, or articles from one particular category, or teaser content from a bunch of sections (title, image and excerpt, perhaps).

That way you don’t have “duplicate” content as such, you just trail it on the default page and people can click through to see the full article in its own section.

As colak says, if you want content to appear solely on the default page and nowhere else, create a pageless section, write your content and assign it to that section, then use <txp:article_custom section="your-pageless-section" /> to pull it onto the page in your template. Just be aware that such content does not have a permlink so you cannot link to it individually from anywhere via URL.

Last edited by Bloke (2020-08-03 18:24:57)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2020-08-03 19:16:24

Amin
New Member
Registered: 2020-08-03
Posts: 7

Re: [SOLVED] Home page

Bloke wrote #325105:

Yay!

You can’t. Not directly. You assign articles to any other section and they appear in their respective sections when you navigate to them. The front page (default) is where you display collections such as lists of articles by one author, or articles from one particular category, or teaser content from a bunch of sections (title, image and excerpt, perhaps).

That way you don’t have “duplicate” content as such, you just trail it on the default page and people can click through to see the full article in its own section.

As colak says, if you want content to appear solely on the default page and nowhere else, create a pageless section, write your content and assign it to that section, then use <txp:article_custom section="your-pageless-section" /> to pull it onto the page in your template. Just be aware that such content does not have a permlink so you cannot link to it individually from anywhere via URL.

Thank you so much for your help. Solved!

Offline

#8 2020-08-03 19:17:27

Amin
New Member
Registered: 2020-08-03
Posts: 7

Re: [SOLVED] Home page

Bloke wrote #325105:

Yay!

You can’t. Not directly. You assign articles to any other section and they appear in their respective sections when you navigate to them. The front page (default) is where you display collections such as lists of articles by one author, or articles from one particular category, or teaser content from a bunch of sections (title, image and excerpt, perhaps).

That way you don’t have “duplicate” content as such, you just trail it on the default page and people can click through to see the full article in its own section.

colak wrote #325104:

There is another way! You can use a pageless section. Create another section, and make sure that it does not use any page or css.

Assign the article in that section and then call it. In theory the article will not appear anywhere else except where you call it from. Having said that, I am trying to imagine how your default page looks like in order to advice you properly. If you want, it will be easier if you can copy/paste it here.

It was very nice idea. Thank you Sir!

Offline

Board footer

Powered by FluxBB