Peculiar_Investor wrote: ↑
Fri Feb 07, 2020 9:04 am
digarei wrote: ↑
Thu Feb 06, 2020 11:58 pm
. . .
How do I create a link that will highlight the last post in a specific thread topic?
I'm curious to the use case, could you expand a bit further on what you are trying to accomplish?
I'm going to take a bit of a guess and explain a specific use case, if you are viewing a forum index
, it is possible to jump to the last post. It is dependent on the device:
- on a desktop - look at the Last post column, beside the member name is an diagonal arrow pointing to the right. Hover over it and the tooltip says "Go to last post".
- on a mobile device, the date/time field is a clickable link to the last post.
I use the first post of a local chapters master thread to provide information about our next chapter meeting. The URL used to reference this page is simply
Code: Select all
A few local chapters do as I do: they use the first post to update upcoming meetings, so I can likewise create a link referencing only the topic. When clicked, the URL will display the first post in that topic.
Other chapters advertise their upcoming meetings by creating a new post, which naturally falls to the bottom, chronologically. It’s the latest post that I wish to target, regardless of whether it has already been read by the user or others.
The URL should work as the one above does now: as a link on this forum, on Facebook or from a webpage. Desktop or mobile device.
GrowthSeeker wrote: ↑
Fri Feb 07, 2020 12:51 am
Good question. I'm not a guru, but you could start by web scraping the first page to see how many posts there are. Then append "&start=N" where "N" is that number rounded down to the nearest multiple of 50. That gets you to the top of the last page.
I checked several pages, and the next step is to append "#pM" where M is a 7 digit number, but I can't quite figure that one out. Maybe easier to loop through tags that match the title of the page.
There seems to be a div tag and also an <a href="..." tag which each include that #pM code where M is a 7 digit number. If you could capture that and append it to the URL, you'd be in business.
But you probably already figured that much out. I don't know if there is a keyword, such as "#unread" which connotes the last post.
Yes, I’m thinking there must be a parameter (“lastpost” or “end”) that I can attach to the URL string.
Connect with Bogleheads in Northern California! Click the link under my user info/avatar.