# \[Hlelp\] Getting the date from file name

**URL:** https://talk.jekyllrb.com/t/hlelp-getting-the-date-from-file-name/4028
**Category:** Help
**Created:** [March 7, 2020, 5:23pm UTC](https://talk.jekyllrb.com/t/hlelp-getting-the-date-from-file-name/4028 "2020-03-07T17:23:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![nayabbashasayed](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/nayabbashasayed/32/175_2.png) [@nayabbashasayed](https://talk.jekyllrb.com/u/nayabbashasayed)
#### Post date: [March 7, 2020, 5:23pm UTC](https://talk.jekyllrb.com/t/hlelp-getting-the-date-from-file-name/4028/1 "2020-03-07T17:23:29Z")

</div>

Hi,

I would like to add `Edit on github` button for my posts. When user clicks on the button, it should take user to the respective page on github in the edit mode.

As posts in the \_posts folder starts with YYYY-MM-DD format, is there any way I could read the date (or entire file name) from the file name so that I can integrate that into my post?

Thanks in the advance.

---

<div class="post-metadata">

### Author: ![mmistakes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mmistakes/32/2169_2.png) [@mmistakes](https://talk.jekyllrb.com/u/mmistakes)
#### Post date: [March 7, 2020, 5:52pm UTC](https://talk.jekyllrb.com/t/hlelp-getting-the-date-from-file-name/4028/2 "2020-03-07T17:52:03Z")

</div>

> **[How to add an “improve this content” button to your GitHub Pages site](https://ben.balter.com/2015/09/13/github-pages-edit-button/)**
>
> If you host your site on GitHub or GitHub Pages, an edit button (and thus encouraging collaboration around your content) is simply a matter of linking to an easily predictable URL.

**TL/DR:** If you use `page.path` you don’t have to infer the date, it will give you the raw file path to the post or page. Then you can do something like:

```auto
<a href="https://www.github.com/{{ site.github_username }}/{{ site.git_repo }}/blob/master/{{ page.path }}">Edit on GitHub</a>

```
