Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2019-05-14 19:24:09
- dinoact
- New Member
- Registered: 2010-03-17
- Posts: 9
Home Page vs Date Based Archive Help
I have a somewhat specific way I want my site set up and have never had 100% success when trying it out with TXP. Any help with how to implement would be hugely appreciated. I’m switching from an old version of Movable Type and am trying to recreate its functionality.
What I can get working:
Home Page of site: most recent article
Category article list page: list of all articles in that category
Post entry page: The article
What I can’t get working (or when I do get it working, it breaks other things, namely the home page):
Date-based archive page: list of all articles for a specific month/year – example URL would be website.com/2019/04/, which using the 4.7 default theme treats the content exactly like the home page
For my settings, I’m using /year/month/day/title for the URL pattern
Thanks,
John
Offline
Re: Home Page vs Date Based Archive Help
Hi John,
Textpattern will automatically respond to /YYYY/MM/ urls to show the list of articles from that month, but doesn’t seem to do the same for just the year without some extra trickery.
One workaround people have used is to create an article or a section for that year (depends on your url scheme), and then do a custom txp:article_custom using the month
attribute (see the docs) to output articles for the entire year. (I’m whizzing through this because I saw you’ve authored some more complex tips on this in past.)
But maybe this thread from Michael from a while back would help you. He has a small plugin that detects the url parts and provides you with the means to respond to them.
As regards the default page, it should by default just show you the last 5 articles in full, but you can simply change the limit
to 1
on this line to make it show just one article and specify an own form
if you want it in a special format. There’s a similar line in Michael’s example too.
TXP Builders – finely-crafted code, design and txp
Offline
Re: Home Page vs Date Based Archive Help
jakob wrote #318000:
Hi John,
Textpattern will automatically respond to /YYYY/MM/ urls to show the list of articles from that month, but doesn’t seem to do the same for just the year without some extra trickery.
Yes, historically it considers /abcd/
as section abcd
, which is fine per se. Should we introduce an exception for year-like values? Dunno…
But /2019/05/
should work as expected, please confirm.
Offline
Re: Home Page vs Date Based Archive Help
Additionally, there is a bug in /year/month/day/title
mode: the second page of /?month=1984
listing has /1984/?pg=2
URL, currently interpreted as s=1984&pg=2
. We should either generate /?month=1984&pg=2
link in this case or consider /1984/
as a year number and not a section name. Orwell fans might be affected, though…
Offline
Re: Home Page vs Date Based Archive Help
etc wrote #318020:
Additionally, there is a bug in
/year/month/day/title
mode: the second page of/?month=1984
listing has/1984/?pg=2
URL, currently interpreted ass=1984&pg=2
.
Hmmm, that’s interesting. Is it dangerous, as you suggest, to consider all-numeric section names comprising exactly 4 digits to be years and interpret them as year/month/day/title
? I’d be tempted to say it’s safe, but I’ve been known to be wrong.
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
Re: Home Page vs Date Based Archive Help
Bloke wrote #318068:
Is it dangerous, as you suggest, to consider all-numeric section names comprising exactly 4 digits to be years and interpret them as
year/month/day/title
? I’d be tempted to say it’s safe, but I’ve been known to be wrong.
I’ve learned that every change is dangerous. :-) I’m tempted by a hybrid approach: if there is such section — let it be. Otherwise it’s year.
Offline
Re: Home Page vs Date Based Archive Help
etc wrote #318073:
I’m tempted by a hybrid approach: if there is such section — let it be. Otherwise it’s year.
That sounds the most sensible option. As we work towards user-customisable permlink schemes, this sort of exception might need more consideration.
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
Re: Home Page vs Date Based Archive Help
Yep, exceptions are Pandora boxes. And I wouldn’t be surprised if someone called his sections 2019
and so on. No clue…
Offline
Re: Home Page vs Date Based Archive Help
etc wrote #318073:
I’m tempted by a hybrid approach: if there is such section — let it be. Otherwise it’s year.
I agree that sounds sensible too. If I’ve understood you correctly, if someone names their section 2019
it shows the section’s page template not the year filter.
TXP Builders – finely-crafted code, design and txp
Offline
Re: Home Page vs Date Based Archive Help
Hi all,
Although it would be great if user-customisable permlink schemes are implemented, I have my doubts about dates in urls as they are more appropriate for blogging platforms and not very relevant for a CMS.
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: Home Page vs Date Based Archive Help
jakob wrote #318081:
If I’ve understood you correctly, if someone names their section
2019
it shows the section’s page template not the year filter.
Yes, that would be mostly bw-compatible, but also yields potential SE issues: all of a sudden /2019/
URL can land you on a different page. I think the best way is to always see /2019/
as the year filter in year/month/day/title
mode, and suggest to few users that need a numeric section to use a different permlink mode.
colak wrote #318082:
Although it would be great if user-customisable permlink schemes are implemented, I have my doubts about dates in urls as they are more appropriate for blogging platforms and not very relevant for a CMS.
BW compatibility is one of the greatest challenges we have to face :-/
Offline
Re: Home Page vs Date Based Archive Help
etc wrote #318083:
BW compatibility is one of the greatest challenges we have to face :-/
I can fully understand and support that, but the potential idea that we could have domain.tld/section-name/fake-subsection/article-title
or even domain.tld/section-name/fake-subsection/fake-sub-subsection/article-title
out of the box really excites me as it will deplete the need for subdomains:)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline