mmistakes / jekyll-theme-skinny-bones

A Jekyll starter with a variety of flexible layouts and components.
https://mmistakes.github.io/jekyll-theme-skinny-bones
MIT License
804 stars 906 forks source link

Modified date #25

Closed tclose closed 8 years ago

tclose commented 9 years ago

Hi MIchael,

Nice templates! I just have a few questions on how to use them properly the first of which is getting the modified date to show up properly. I have this "article" md file at "/by-laws/"


---
layout: article
title: "By-laws"
modified: 2014-10-02
image:
  feature:
  teaser:
  thumb:
share: false
toc: false

---

test

which shows up fine but doesn't include the modified date, what am I missing?

mmistakes commented 9 years ago

Here's how post dates work...

On category/archive/index/whatever pages that list posts, the dates shown there pull from the posts' filenames since this is what is used to sort them in reverse chronology.

articles-pub-date

When you add a modified date to a post it does not effect the date show in the archive pages since as stated above they're ordered by the post's filename. I thought it would be strange to have posts with a modified date of say 2015 displaying out of order. You can certainly modify the post-grid.html include to display post.modified instead of post.date.

Adding a modified date to a post/page's YAML shows up at the bottom of the post. It will override whatever the published date was with the newer one. For example this post has a filename of 2014-11-29-syntax-highlighting-test.md which gives it a published date of November 29, 2014.

post-pub-date

Adding modified: 2015-03-06 to the post's YAML Front Matter would change the date to March 6, 2015 as shown in this example.

post-modified-date

Hope this clears it up for you.

tclose commented 9 years ago

Hi Michael,

Okay, so the problem is that I am abusing the notion of articles and posts at different points on my site, which is for a software specification language, rather than a blog (although it does have a news feed).

In the case I mentioned above, I was hoping to use your "updated tag" to put a date down the bottom of our by-laws to say when they came into effect. But I didn't realise that that date came from the post file name rather than the "modified" yaml field. If I wanted to hack this where does this "updated" line come from?

My other question is on similar theme, where is the date being parsed from the post file names? As I have co-opted the media archive page to serve as a gallery for the software packages that support currently our specification language, and so I would prefer to omit the date from the filename of those "posts" and just sort them alphabetically (although I would like to keep the ability to sort the news items by date).

To check out what I have done so far please have a look here, http://tclose.github.io/nineml/, (note I am still waiting on my institute's account section to organise the wire transfer for the banner image:).

Thanks again for the nice template and the help getting it to work.

Cheers,

Tom

PS Any tips on getting the favicon to work. Does it need to be a png to start off with?

On 6 March 2015 at 22:26, Michael Rose notifications@github.com wrote:

Here's how post dates work...

On category/archive/index/whatever pages that list posts, the dates shown there pull from the posts' filenames since this is what is used to sort them in reverse chronology.

[image: articles-pub-date] https://cloud.githubusercontent.com/assets/1376749/6525901/631c035e-c3d9-11e4-8a4c-4a8f00a05b29.png

When you add a modified date to a post it does not effect the date show in the archive pages since as stated above they're ordered by the post's filename. I thought it would be strange to have posts with a modified date of say 2015 displaying out of order. You can certainly modify the post-grid.html include to display post.modified instead of post.date.

Adding a modified date to a post/page's YAML shows up at the bottom of the post. It will override whatever the published date was with the newer one. For example this post has a filename of 2014-11-29-syntax-highlighting-test.md which gives it a published date of November 29, 2014.

[image: post-pub-date] https://cloud.githubusercontent.com/assets/1376749/6525942/f494ab1a-c3d9-11e4-9311-7ec0f459c2c3.png

Adding modified: 2015-03-06 to the post's YAML Front Matter would change the date to March 6, 2015 as shown in this example.

[image: post-modified-date] https://cloud.githubusercontent.com/assets/1376749/6525947/0f40b530-c3da-11e4-88f8-46dfceba615f.png

Hope this clears it up for you.

— Reply to this email directly or view it on GitHub https://github.com/mmistakes/skinny-bones-jekyll/issues/25#issuecomment-77558000 .

Thomas G. Close, PhD. Postdoctoral Researcher, Computational Neuroscience Unit, Okinawa Institute of Science and Technology e: tclose@oist.jp w: +81 98 966 8804

mmistakes commented 9 years ago

I totally get hacking posts to group other types of content -- I've done that myself.

You might want to take a look at Collections in Jekyll if you haven't already. They're built to do exactly what you want. The only limitations they have I know of is you can't really paginate over them and if you want to sort them you need provide your own method of doing that by adding some extra YAML, which you're essentially doing anyways with modified.


But to answer your question, to use the modified date instead you just need to edit some of the _includes used. If you look at the post-grid.html include you'll see it's using post.date for the date. This comes from the posts' filename. You could change it to post.modified and it would use whatever date you include in the YAML Front Matter instead. Same goes for removing the date. You can either take that line out, create a new include and use that for just your media pages, or even use some CSS to display: none; the date class. There's a lot of options and it's really up to you and how creative you want to get with it.

You could also try adding date: 2015-03-08 to your posts and see if that overrides the date in the filename. I've never tried it but that could be an option for you instead of adding a modified: field to your posts to track updated dates.


To sort posts alphabetically you'd likely need to modify the Liquid used in the post for loops on any given page where you want to display them. I've never tried it so you'll need to bump around Google or ask for help on Stack Overflow.

I'm pretty sure the Healthcare.gov site that was built with Jekyll used the "make everything a post" and hack the date in the filename approach. What you would do here is have all of your posts share the same date and then everything that comes after the date would sort alphabetically.

0001-01-01-a.md
0001-01-01-b.md
0001-01-01-c.md

Back to Collections. If you use them they don't require dates in the filenames and sort alphabetically by default. Is use them to create the FAQ section on my site.


And for favicons, I like the Favicon Generator. It's by far the most comprehensive and easy solution. You feed it a graphic you want to use and it will spit it out in all the various formats and sizes needed for all devices and browsers along with the HTML markup that you can copy/paste into your site.

tclose commented 9 years ago

Thanks,

On 9 March 2015 at 06:31, Michael Rose notifications@github.com wrote:

I totally get hacking posts to group other types of content -- I've done that myself.

You might want to take a look at Collections http://jekyllrb.com/docs/collections/ in Jekyll if you haven't already. They're built to do exactly what you want. The only limitations they have I know of is you can't really paginate over them and if you want to sort them you need provide your own method of doing that by adding some extra YAML, which you're essentially doing anyways with modified.

That sounds like something to look into in the future, but for now quick and dirty will do :)


But to answer your question, to use the modified date instead you just need to edit some of the _includes used. If you look at the post-grid.html https://github.com/mmistakes/skinny-bones-jekyll/blob/master/_includes/post-grid.html include you'll see it's using post.date for the date. This comes from the posts' filename. You could change it to post.modified and it would use whatever date you include in the YAML Front Matter instead. Same goes for removing the date. You can either take that line out, create a new include and use that for just your media pages, or even use some CSS to display: none; the date class. There's a lot of options and it's really up to you and how creative you want to get with it.

You could also try adding date: 2015-03-08 to your posts and see if that overrides the date in the filename. I've never tried it but that could be an option for you instead of adding a modified: field to your posts to track updated dates.

Thanks, have got that working now


To sort posts alphabetically you'd likely need to modify the Liquid used in the post for loops on any given page where you want to display them. I've never tried it so you'll need to bump around Google or ask for help on Stack Overflow.

I'm pretty sure the Healthcare.gov site https://github.com/Conservatory/healthcare.gov-2013-10-01 that was built with Jekyll used the "make everything a post" and hack the date in the filename approach. What you would do here is have all of your posts share the same date and then everything that comes after the date would sort alphabetically.

0001-01-01-a.md0001-01-01-b.md0001-01-01-c.md

Ah I see, I am pretty new to Jekyll and wasn't sure what was built-in and what was down to your templates. Your suggestion works well, the only thing I needed to add was a reverse statement to the loop through the post grids to get it to go A-Z instead of Z-A.


Back to Collections. If you use them they don't require dates in the filenames and sort alphabetically by default. Is use them to create https://github.com/mmistakes/made-mistakes-jekyll/tree/master/_faqs the FAQ section https://mademistakes.com/faqs/ on my site.


And for favicons, I like the Favicon Generator http://realfavicongenerator.net/. It's by far the most comprehensive and easy solution. You feed it a graphic you want to use and it will spit it out in all the various formats and sizes needed for all devices and browsers along with the HTML markup that you can copy/paste into your site.

Thanks, that sounds perfect.

— Reply to this email directly or view it on GitHub https://github.com/mmistakes/skinny-bones-jekyll/issues/25#issuecomment-77775669 .

Thomas G. Close, PhD. Postdoctoral Researcher, Computational Neuroscience Unit, Okinawa Institute of Science and Technology e: tclose@oist.jp w: +81 98 966 8804