X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/a24a669cabb9475e2e4bddb588ef15b51d73d376..1c044400184648cbb511b796ad0499e53b21d084:/doc/forum/How_does_ikiwiki_remember_times__63__.mdwn diff --git a/doc/forum/How_does_ikiwiki_remember_times__63__.mdwn b/doc/forum/How_does_ikiwiki_remember_times__63__.mdwn index 0e771cd0d..6ce576db1 100644 --- a/doc/forum/How_does_ikiwiki_remember_times__63__.mdwn +++ b/doc/forum/How_does_ikiwiki_remember_times__63__.mdwn @@ -49,6 +49,7 @@ Do I have it right? > > Surely it is not the _last changed time_ but the _first seen time_ of each page that is pulled out of the VCS? > > If the aim is to get the real creation times of items in weblogs, then the last times that the items were > > changed in the VCS is not going to help. -- [[seanh]] +>>> Typo, fixed. --[[Joey]] > > > If you want to preserve the date of a page, the best way to do it is to > > > use [[ikiwiki/directive/meta]] date="foo". This will survive checkouts, @@ -58,3 +59,51 @@ Do I have it right? > > > > normally lose the times also. (And in that case I think both times are irretrievable, even by > > > > `--getctime`). I might start using a simple script to make blog posts that creates a file for > > > > me, puts today's date in the file as a meta, and opens the file in my editor. -- [[seanh]] + +>>>>> I use a script that does that and also sets up templates and tags +>>>>> for a new item: + + #!/bin/sh + set -u + set -e + + if [ $# -ne 1 ]; then + echo usage: $0 pagename >&2 + exit 1 + fi + + pagename="$1" + + if [ -e "$pagename" ]; then + echo error: "$pagename" exists >&2 + exit 1 + fi + + date=$(date) + echo '\[[!template id=draft]]' >> "$pagename" + echo "\[[!meta date=\"$date\"]]" >> "$pagename" + echo "\[[!tag draft]]" >> "$pagename" + git add "$pagename" + $EDITOR "$pagename" + +>>>>> -- [[Jon]] + +> A quick workaround for me to get modification times right is the following +> little zsh script, which unfortunately only works for git: + + #!/usr/bin/env zsh + + set +x + + for FILE in **/*(.); do + TIMES="`git log --pretty=format:%ai $FILE`" + MTIME="`echo $TIMES | head -n1`" + + if [ ! -z $MTIME ]; then + echo touch -m -d "$MTIME" $FILE + touch -m -d "$MTIME" $FILE + fi + + done + +> --[[David_Riebenbauer]]