1 This is similar to the last post in this forum. I want to know exactly how ikiwiki remembers the times associated with pages, especially when using it for blogging, so I know whether I can trust it or not. From that last thread, I think what ikiwiki does is this:
3 * The created time of a file is when that file was first committed into the versioning repository (in my case git)
5 > If `--getctime` it used, yes. In normal operation, when new files
6 > are added, ikiwiki sets the creation time to the ctime of the file
7 > on disk, rather than bothering to ask the VCS. --[[Joey]]
9 * The modified time of a file is what that file was last updated in the repository
11 > Almost right, the modified time is actually taken from the
12 > modification time of the file in disk. --[[Joey]]
14 And with a blog, by default, the posts are ordered by creation time, although an option can order them by modified time.
16 Okay. So this should mean that the times are safe if, for example, I delete my working copy and then clone another one from the bare git repository, or otherwise mess up the creation times and mtimes stored as file metadata on the filesystem.
20 > Some VCS, like git, set the file mtimes to the current time
21 > when making a new checkout, so they will be lost if you do that.
22 > The creation times can be retrived using the `--getctime` option.
25 > > Thanks for the clarification. I ran some tests of my own to make sure I understand it right, and I'm satisfied
26 > > that the order of posts in my blog can be retrieved from the VCS using the `--getctime` option, at least if I
27 > > choose to order my posts by creation time rather than modification time. But I now know that I can't rely on
28 > > page modification times in ikiwiki as these can be lost permanently.
30 > > > Update: It's now renamed to `--gettime`, and pulls both the creation
31 > > > and modification times. Also, per [[todo/auto_getctime_on_fresh_build]],
32 > > > this is now done automatically the first time ikiwiki builds a
33 > > > srcdir. So, no need to worry about this any more! --[[Joey]]
35 > > I would suggest that there should at least be a `--getmtime` option like you describe, and perhaps that
36 > > `--getctime` and `--getmtime` be _on by default_. In my opinion the creation times and modification times of
37 > > pages in ikiwiki are part of the user's content and are important to protect, because the user may be relying
38 > > on them, especially if they use blogging or lists of recently modified pages, etc. Right now the modification
39 > > times can be lost permanently.
41 > > Is there a typo in the description of `--getctime` in the man page?
44 > > > Pull **last changed time** for each new page out of the revision
45 > > > control system. This rarely used option provides a way to get
46 > > > the real creation times of items in weblogs, such as when buildā
47 > > > ing a wiki from a new Subversion checkout. It is unoptimised and
48 > > > quite slow. It is best used with --rebuild, to force ikiwiki to
49 > > > get the ctime for all pages.
51 > > Surely it is not the _last changed time_ but the _first seen time_ of each page that is pulled out of the VCS?
52 > > If the aim is to get the real creation times of items in weblogs, then the last times that the items were
53 > > changed in the VCS is not going to help. -- [[seanh]]
54 >>> Typo, fixed. --[[Joey]]
56 > > > If you want to preserve the date of a page, the best way to do it is to
57 > > > use [[ikiwiki/directive/meta]] date="foo". This will survive checkouts,
58 > > > VCS migrations, etc. -- [[Jon]]
60 > > > > That's a good tip Jon. That would also survive renaming a page by renaming its mdwn file, which would
61 > > > > normally lose the times also. (And in that case I think both times are irretrievable, even by
62 > > > > `--getctime`). I might start using a simple script to make blog posts that creates a file for
63 > > > > me, puts today's date in the file as a meta, and opens the file in my editor. -- [[seanh]]
65 >>>>> I use a script that does that and also sets up templates and tags
73 echo usage: $0 pagename >&2
79 if [ -e "$pagename" ]; then
80 echo error: "$pagename" exists >&2
85 echo '\[[!template id=draft]]' >> "$pagename"
86 echo "\[[!meta date=\"$date\"]]" >> "$pagename"
87 echo "\[[!tag draft]]" >> "$pagename"
93 > A quick workaround for me to get modification times right is the following
94 > little zsh script, which unfortunately only works for git:
96 >> Elided; no longer needed since --gettime does that, and much faster! --[[Joey]]
98 > --[[David_Riebenbauer]]