{"id":19348914,"url":"https://github.com/cityofsantamonica/jekyll-frontmatter-jsonify","last_synced_at":"2025-04-23T06:30:43.900Z","repository":{"id":56878567,"uuid":"59150517","full_name":"CityofSantaMonica/jekyll-frontmatter-jsonify","owner":"CityofSantaMonica","description":"Liquid filter to jsonify your collection's frontmatter","archived":false,"fork":false,"pushed_at":"2016-05-23T17:47:07.000Z","size":8,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-05-02T06:16:38.848Z","etag":null,"topics":["jekyll-plugin","json","liquid"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/jekyll-frontmatter-jsonify","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CityofSantaMonica.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-18T20:53:58.000Z","updated_at":"2021-02-23T19:22:47.000Z","dependencies_parsed_at":"2022-08-20T11:40:31.613Z","dependency_job_id":null,"html_url":"https://github.com/CityofSantaMonica/jekyll-frontmatter-jsonify","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CityofSantaMonica%2Fjekyll-frontmatter-jsonify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CityofSantaMonica%2Fjekyll-frontmatter-jsonify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CityofSantaMonica%2Fjekyll-frontmatter-jsonify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CityofSantaMonica%2Fjekyll-frontmatter-jsonify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CityofSantaMonica","download_url":"https://codeload.github.com/CityofSantaMonica/jekyll-frontmatter-jsonify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250384680,"owners_count":21421771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jekyll-plugin","json","liquid"],"created_at":"2024-11-10T04:23:51.081Z","updated_at":"2025-04-23T06:30:43.668Z","avatar_url":"https://github.com/CityofSantaMonica.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jekyll Frontmatter Jsonify\n\n## Use it\n\nTake a look at [Jekyll's instructions for loading plugins](https://jekyllrb.com/docs/plugins/#installing-a-plugin).\n\n```\ngem install jekyll-frontmatter-jsonify\n```\n\n## The problem\n\nThe `jsonify` filter when applied to a collection will convert only the body of the collection item into a JSON array, and not the frontmatter.\n\nFor example, we have a collection with two items:\n\n**_sample_collection/item1.md**\n\n```\n---\nfood: bacon\n---\n\nSample Content from 'item1.md'\n```\n\n**_sample_collection/item2.md**\n\n```\n---\nfood: toast\n---\n\nAwesome content from 'item2.md'\n```\n\n### The `jsonify` filter\n\n```\n{{ site.sample_collection | jsonify }}\n```\n\n**Returns**\n\n```\n[ \"Sample Content from 'item1.md'\", \"Awesome content from 'item2.md'\" ]\n```\n\n## The solution\n\nThis plug-in introduces the `collection_jsonify` Liquid filter which will convert each collection item's frontmatter into a JSON array.\n\n```\n{{ site.sample_collection | collection_jsonify }}\n```\n\n**Returns**\n\n```\n[\n  {\n      \"food\": \"bacon\",\n      // Jekyll default keys\n      \"draft\": false,\n      \"categories\": [],\n      \"ext\": \".md\"\n  },\n  {\n      \"food\": \"toast\",\n      // Jekyll default keys\n      \"draft\": false,\n      \"categories\": [],\n      \"ext\": \".md\"\n  }\n]\n```\n\nThis filter takes a single boolean as a parameter (defaults to `false`) that will ignore Jekyll's default keys in the frontmatter and only return the custom data a collection item has in its frontmatter. In the above example, only the \"food\" key would be outputted if the parameter was set to true (i.e. ` | collection_jsonify: true`)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcityofsantamonica%2Fjekyll-frontmatter-jsonify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcityofsantamonica%2Fjekyll-frontmatter-jsonify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcityofsantamonica%2Fjekyll-frontmatter-jsonify/lists"}