diff options
Diffstat (limited to 'pkg/index')
| -rw-r--r-- | pkg/index/index.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/index/index.go b/pkg/index/index.go index 8c21e72..f4e4593 100644 --- a/pkg/index/index.go +++ b/pkg/index/index.go @@ -70,6 +70,20 @@ func (idx Index) String() string { } var _ yaml.NodeUnmarshaler = (*Document)(nil) +var _ yaml.BytesMarshaler = (*Document)(nil) + +func (doc *Document) MarshalYAML() ([]byte, error) { + return yaml.Marshal(yaml.MapSlice{ + {Key: "path", Value: doc.Path}, + {Key: "title", Value: doc.Title}, + {Key: "date", Value: doc.Date}, + {Key: "filetime", Value: doc.FileTime}, + {Key: "authors", Value: doc.Authors}, + {Key: "tags", Value: doc.Tags}, + {Key: "links", Value: doc.Links}, + {Key: "meta", Value: doc.OtherMeta}, + }) +} func (doc *Document) UnmarshalYAML(node ast.Node) error { // parse top level fields |
