blogit v1.0.0 Blogit.Models.Post.Meta View Source

Represents the meta-data of a post.

Provides function to read/parse the meta information from a file. All the meta-fields have default values. The meta information can be defined in different places.

The highest priority place is the post itself. There is a configuration for meta_divider and the meta information can be stored at the top of the markdown file’s content in YAML format. The markdown content and meta-data are divided using the meta_divider.

With lower priority are files stored in a sub folder of the folder containing the post markdown files, called meta/. If a post content is sotred in a file called some_post.md, its meta-data have to be stored in a YAML file, located at meta/some_post.yml.

With the lowest priority are the defaults and values read from the repository containing the file.

Link to this section Summary

Functions

Retrieves the folder where the meta information files reside

Creates a Post.Meta structure using the source file of a Post, its raw data and the repository containing the blog data

Link to this section Types

Link to this type t() View Source
t() :: %Blogit.Models.Post.Meta{author: String.t, category: String.t, created_at: Calendar :: NaiveDateTime.t, month: String.t, pinned: boolean, published: boolean, tags: [String.t], title: String.t, title_image_path: String.t, updated_at: Calendar :: NaiveDateTime.t, year: String.t}

Link to this section Functions

Retrieves the folder where the meta information files reside.

Examples

iex> folder = Blogit.Models.Post.Meta.folder()
iex> Path.split(folder)
~w(posts meta)
Link to this function from_file(file_path, repository, raw, name) View Source

Creates a Post.Meta structure using the source file of a Post, its raw data and the repository containing the blog data.