diff --git a/config.py.example b/config.py.example index 0334a0e..7f86ecb 100644 --- a/config.py.example +++ b/config.py.example @@ -79,7 +79,7 @@ post_props = [ # disabled. # # Exemple: if the property is tags, then it will generate a tag index tags.gmi, -# which will ling to some subindexes like tags/computer (assuming computer is +# which will link to some subindexes like tags/computer (assuming computer is # an existing tag). # # Specify here a list of dictionnary, each one with the following keys: diff --git a/geminer.py b/geminer.py index 3648e8f..04fa2b2 100755 --- a/geminer.py +++ b/geminer.py @@ -68,12 +68,17 @@ for dirname, subdirlist, mdlist in os.walk('.'): # Parse the YAML header meta = frontmatter.parse(mdtext)[0] - # Extract useful informations from the header - post["template"] = meta.get("template", None) - post["author"] = meta.get("author", None) - post["date"] = meta.get("date", None) - post["title"] = meta.get("title", None) - post["tags"] = meta.get("tags", None).split(',') + # Extract post properties + for prop in config.post_props: + post[prop] = meta.get(prop, None) + + # Extract index properties + for prop_dict in config.index_props: + prop = prop_dict["property"] + post[prop] = meta.get(prop, None) + if prop_dict.get("list", False) and post[prop]: + post[prop] = post[prop].split(',') + # For now, tags list must be a comma-separated string # TODO: make possible to list tags as a YAML list