-
Notifications
You must be signed in to change notification settings - Fork 62
Markdown metadata for date
field is all in 1970
#507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
For my website, I use a tool in my GitHub Actions workflow to restore the modified time to my post Markdown files so that the RSS feed always has the true last modified time: - name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # need to fetch all commits for git restore-mtime
- name: Restore timestamps
run: sudo apt-get install git-restore-mtime && git restore-mtime Then, you can remove this field from the metadata of each file, and in Python, you can do |
Pinging @sneakers-the-rat. This is odd, but it looks like the frontmatter you added got some generated dates? It looks to me like it was something akin to |
Lol no those were just placeholder dates intended to be replaced with actual dates I dont think I changed the mtime, but this would probably do it: https://github.com/pyOpenSci/python-package-guide/pull/488/files#diff-77763db26eb3ad9b3f8b8b9104c9ec0b97bbc5d264f644f811803ca1381616a1R4 |
@sneakers-the-rat did the hard work! I went in and added the titles and descriptions to each file. ❤ So I think our next step is to implement the CI action, and delete the existing date front matter "field". And then we will have a last modified date that automagically updates as we commit changes to each lesson. UNRELATED TO THIS THREAD (but related to the big picture): |
hell ya. i have found that i pretty much always want to have an explicit "date created" and an automatic "date updated" when i do bloglike things, but that's also because i fiddle with my documents all the time and am very indecisive about when i call things "done." <3. (up to you obvi) i had thought about adding this when i wrote it, but i think it might be somewhat durable to do that in the extension build action by inspecting |
Nice! I have no specific preference about how we implement this! I haven't worked with git hooks other than pre-commit but if it quietly updates the last_updated date when people commit, with no setup, let's do it. If there is setup for a dev to do with the hook, then we might want to have it be fully CI-driven with a local option to test. I'm open to what y'all think is best practice. Funny timing. I just found this extension today. I wanted to add the last commit date to every rendered page in our handbook, given it has governance stuff, and I want to be transparent. If you look at the bottom of the handbook page, it automagically adds a last updated date to each page using the git history. And all I had to do was create a little Jinja template with |
I guess the way I would do it is to not have it stored statically in the page metadata at all, but just read from mtime when the site is built? That would be one or two lines. But if you are already using something that does that, then might as well be consistent. No strong feelings either. |
I'm all for grabbing the date from the metadata!! Let's do that. So now we need to decide on the approach. Stef's comment above looks clean and simple! Since I don't yet understand how to incorporate the last_updated metadata into the generated feed, I'll rely on your judgment. The extension I found has a good bit of code. If the extension makes things easier, we could use it. But given how simple Stef's example above is, maybe that is the clean way to do things? In short, I feel like I don't know enough here to make a call. But simpler seems most often better :) |
Stef and I are thinking of the same thing! i can draft this, one sec |
Thank you!! |
I just noticed that the
date
field in the metadata for several Markdown files (for exampletutorials/publish-conda-forge.md
) states they were written in 1970. It looks like these were introduced in #488.The text was updated successfully, but these errors were encountered: