I know that this question has been asked before here and here. Both have been answered quite poorly, and none of them do what I wish/expect.
So, let me try this again.
Goal:
I have a blog powered by Jekyll. I would like to be able to load my posts via AJAX and use PushState to speed things up. I'm no Ruby developer, so I have a hard time figuring out what the (poorly written) plugins in the afore-mentioned questions do.
Situation:
My posts are all generated using the date in their path, with a trailing slash (meaning, it generates an index.html
file):
- /2014/09/14/post-title/(index.html)
- /2015/01/02/other-post-title/(index.html)
I cannot change this pattern for SEO reasons; my blog has been online for some years and I would like to keep my URLs working without writing extensive redirection rules.
Question:
What I would like now is, for every post that is rendered as index.html
, I have another version called raw.html
.
Now here comes the tricky part (where the other questions/answers fail):
I want to use a single template for rendering the post body, both for the index.html
file and for the raw.html
file. The reason is I don't want any code duplication.
raw.html
is basically the exact same as index.html
, except index.html
has a footer, header, etc. Currently, I'm achieving this through Liquid template inheritance, but I'm willing to change if required.
Anyone any ideas or pointers ?