Sequential numbering of Tumblr posts?
July 2, 2013 8:32 AM Subscribe
Is there a clever way to have sequential numbering on Tumblr posts? What I'm looking for is a way to have my posts numbered "Week 1," "Week 2," etc.
I figured out a way to add JavaScript, by making a Global var in the head (weekNum=0;), then in the relevant section adding:
Thanks in advance, all you cleverer than me folks...
I figured out a way to add JavaScript, by making a Global var in the head (weekNum=0;), then in the relevant section adding:
// in script tags, of course... w= "Week " + (weekNum+1) ; weekNum++; document.write(w);This works like a charm, except because the posts are generated from the newest to the oldest, the numbering is backwards.
Thanks in advance, all you cleverer than me folks...
Response by poster: I could get the page number, I think, but what if the page isn't filled? Like now, where there are 3 posts on a page that fills at 10?
Thanks, though.
posted by jpburns at 9:24 AM on July 2, 2013
Thanks, though.
posted by jpburns at 9:24 AM on July 2, 2013
I don't know what code you might need, but to put a point on infrastructure, have it look at the date and year so you don't have weirdness when you roll the calendar over to week 54 ...
posted by tilde at 9:24 AM on July 2, 2013
posted by tilde at 9:24 AM on July 2, 2013
How about native tumblr tagging on each post.
posted by artlung at 10:24 AM on July 2, 2013
#week-1
, #week-2
, etc. Then in your theme you can use those however you like.posted by artlung at 10:24 AM on July 2, 2013
You can sort chronologically on a specific Tumblr tag by adding "/chrono" to the end of it.
posted by calistasm at 10:56 AM on July 2, 2013
posted by calistasm at 10:56 AM on July 2, 2013
Response by poster: artlung - I was looking for an automagic way to fill in the weeks type, not something I'd have to fill in each time I post. But thanks.
calistasm - can you elucidate? I don't get it...
posted by jpburns at 11:08 AM on July 2, 2013
calistasm - can you elucidate? I don't get it...
posted by jpburns at 11:08 AM on July 2, 2013
Basically, you can append "/chrono" to the end of a tag on Tumblr like so:
http://my.tumblr.com/tagged/tag/chrono
That will make it sort in chronological order from first post to last. It's not perfect if you want to separate things out by time period, but if you want to show a progression or sequence of events it's useful.
posted by calistasm at 12:10 PM on July 2, 2013
http://my.tumblr.com/tagged/tag/chrono
That will make it sort in chronological order from first post to last. It's not perfect if you want to separate things out by time period, but if you want to show a progression or sequence of events it's useful.
posted by calistasm at 12:10 PM on July 2, 2013
I could get the page number, I think, but what if the page isn't filled? Like now, where there are 3 posts on a page that fills at 10?
Lets say there are 4 pages total, that would be:
( (totalPages-1) x PostsPerPage ) + Posts on current page
posted by backwards guitar at 12:58 PM on July 2, 2013
Lets say there are 4 pages total, that would be:
( (totalPages-1) x PostsPerPage ) + Posts on current page
posted by backwards guitar at 12:58 PM on July 2, 2013
Can you use the timestamp to calculate which week you are on? Maybe a date variable plus Tumblr's variable transformations plus a little scripting will work? Tumblr has a lot of formats for dates including Week of the Year, for example.
posted by bluefly at 1:22 PM on July 2, 2013
posted by bluefly at 1:22 PM on July 2, 2013
Response by poster: Backwards - If only I had some variable that told me total pages (automatically), then I could do what I want. There doesn't seem to be anything that gives me this number, short of delving into the API.
Bluefly - the correct date or number of weeks in a year is not my concern. Getting the sequential number is.
Thanks anyway.
posted by jpburns at 2:19 PM on July 2, 2013
Bluefly - the correct date or number of weeks in a year is not my concern. Getting the sequential number is.
Thanks anyway.
posted by jpburns at 2:19 PM on July 2, 2013
Bluefly - the correct date or number of weeks in a year is not my concern. Getting the sequential number is.
Ah, sorry, I thought you were trying to title your posts based on the week starting with "Week 1." If you know the date (or week in the year and the year) when you start your blog, then you can calculate which week you're on relative to when you started. But if you are just looking for sequential numbering, then, yes, the date doesn't help.
Backwards - If only I had some variable that told me total pages (automatically), then I could do what I want.
There is the TotalPages variable, but I'm not sure it will do what you want. See the Tumblr theme docs on Navigation.
posted by bluefly at 3:53 PM on July 2, 2013
Ah, sorry, I thought you were trying to title your posts based on the week starting with "Week 1." If you know the date (or week in the year and the year) when you start your blog, then you can calculate which week you're on relative to when you started. But if you are just looking for sequential numbering, then, yes, the date doesn't help.
Backwards - If only I had some variable that told me total pages (automatically), then I could do what I want.
There is the TotalPages variable, but I'm not sure it will do what you want. See the Tumblr theme docs on Navigation.
posted by bluefly at 3:53 PM on July 2, 2013
« Older Where in MPLS can I learn to throw a punch? | How to best deal with and/or avoid estranged... Newer »
This thread is closed to new comments.
You could also grab the date of the post, and use Javascript to determine the week based on the starting week?
Also, looking briefly at the theme documentation there seems to be meta-text tags that might do what you want (you'd have to manually add a meta-text tag for each post? I'm really not sure how this works).
posted by backwards guitar at 8:54 AM on July 2, 2013