Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Make the .meta file format identical with reST metadata #954

Kwpolska opened this Issue Dec 10, 2013 · 2 comments


None yet
2 participants

Kwpolska commented Dec 10, 2013

As discussed in #951 and on the mailing list.

Right now, you can just put seven meta elements there: title, slug, date, tags, links, description, and type. (type is new and kinda useless by default) There is no support for any of the other metadata fields, like nocomments, template, password, category (!), (no)annotations, author, or hidetitle. We plan to make it possible by just using the same meta format as we do in reST posts now — stick ".. NAME: " in front of everything, and be explicit.

Note that the 2-file-format is not going away (as it’s required by ipynb, creolewiki, pandoc/latex and possibly others). And there will be a nice converter to fix everything for you.

tl;dr: The .meta file = header of our reST posts.

For the provide a script to upgrade part, there are two ways:

  1. Provide a standalone script, like this one-liner I wrote in July:
awk 'BEGIN {RS = ""; FS="\n"}; {print ".. title: "$1"\n.. slug: "$2"\n.. date: "$3"\n.. tags: "$4"\n.. link: "$5"\n.. description: "$6"\n"}'


for i in *.meta; do
    cat $i | awk 'BEGIN {RS = ""; FS="\n"}; {print ".. title: "$1"\n.. slug: "$2"\n.. date: "$3"\n.. tags: "$4"\n.. link: "$5"\n.. description: "$6"\n"}' > $i'2'
rename .meta2 .meta *.meta2
  1. Write a full-blown script that automates everything and is a Nikola plugin, making usage even easier, i.e.
$ nikola install_plugin meta_upgrade
[2014-02-01T15:35:59Z] NOTICE: install_plugin: Downloading: http://plugins.getnikola.com/v7/meta_upgrade.zip
[2014-02-01T15:36:00Z] NOTICE: install_plugin: Extracting: meta_upgrade into plugins
$ nikola meta_upgrade
Finding .meta files... 500 found
(500/500) Upgrading meta files...
$ rm -rf plugins/meta_upgrade # YAGNI

@Kwpolska Kwpolska was assigned Dec 10, 2013


damianavila commented Dec 10, 2013

I think the second one is the best option...


Kwpolska commented Mar 29, 2014

In progress! Though there is a way to keep old-style metadata files working — should we bother?

@Kwpolska Kwpolska closed this in 89708aa Apr 5, 2014

@Kwpolska Kwpolska added a commit that referenced this issue Apr 5, 2014

@Kwpolska Kwpolska Merge pull request #1184 from getnikola/new-style-meta
Fix #954 -- Make the .meta file format identical with reST metadata.

@Kwpolska Kwpolska removed the in progress label May 16, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment