Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A jekyll filter to sort out and return only the wp:post_meta keys and values
module Jekyll
module WPmetadata
def wpmeta(input)
standard_post = [
"output",
"content",
"relative_path",
"path",
"url",
"collection",
"next",
"previous",
"id",
"draft",
"categories",
"layout",
"title",
"tags",
"slug",
"ext",
"date",
"excerpt",
"author",
"permalink"
]
postdata = input.delete_if {|x| standard_post.index(x)}
end
end
end
Liquid::Template.register_filter(Jekyll::WPmetadata)
# use in a template like this {{ post | wpmeta }}
# returns a hash like { "key" => "value" } for any
# keys in the post hash that are not in the array
# of standard post values (lns 4-24).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.