1.Split and pick the filename from the post of full path:
{% assign file = page.path | split: "/" | last %}
The page.path
which respected the filepath that jekyll does generated.
2.Split the prefix of date, 8(number) + 3(hyphen) = 11(symbol):
{% assign pre = file | slice: 0,11 %}
or
{% assign pre = file | truncate: 11,"" %}
3.Drop that rests:
{% assign fn = file | remove: pre | remove: ".md" %}
For step1 to step3 may simplify:
{% assign fn = page.path | slice: $(a tuple)$ | remove: ".md" %}
Tuple that is a number pair:
(prefix-len + 11),(a number large than filename-len)
The _posts directory tree seems like this:
_posts
|-- xxxx-xx-xx-xxxx.md
|-- ...
|-- xxxx
| |-- xxxx-xx-xx-xxx1.md
| |-- xxxx-xx-xx-xxx2.md
| |-- ...
|-- ...
All posts from subfolder xxxx/ must referal the same filename to handle with, and easy:
{% assign fn = page.path | remove: "_posts/" | split: "/" | first %}
For now, type {{fn}}
to uses that name:
