{"id":17521832,"url":"https://github.com/loehnertz/hexo-custom-fields","last_synced_at":"2025-06-25T13:33:40.815Z","repository":{"id":51057536,"uuid":"90734394","full_name":"loehnertz/hexo-custom-fields","owner":"loehnertz","description":"A Hexo plugin that allows for the default Markdown source files to be used as custom fields","archived":false,"fork":false,"pushed_at":"2021-05-25T10:54:08.000Z","size":15,"stargazers_count":10,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-25T01:44:00.325Z","etag":null,"topics":["custom-fields","hexo","hexo-plugin"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/hexo-custom-fields","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loehnertz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-09T10:41:25.000Z","updated_at":"2022-05-12T15:41:50.000Z","dependencies_parsed_at":"2022-09-18T03:32:05.504Z","dependency_job_id":null,"html_url":"https://github.com/loehnertz/hexo-custom-fields","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/loehnertz/hexo-custom-fields","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loehnertz%2Fhexo-custom-fields","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loehnertz%2Fhexo-custom-fields/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loehnertz%2Fhexo-custom-fields/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loehnertz%2Fhexo-custom-fields/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loehnertz","download_url":"https://codeload.github.com/loehnertz/hexo-custom-fields/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loehnertz%2Fhexo-custom-fields/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261883211,"owners_count":23224455,"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":["custom-fields","hexo","hexo-plugin"],"created_at":"2024-10-20T12:07:06.471Z","updated_at":"2025-06-25T13:33:40.785Z","avatar_url":"https://github.com/loehnertz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hexo-custom-fields\n[![npm](https://img.shields.io/npm/dt/hexo-custom-fields.svg)](https://www.npmjs.com/package/hexo-custom-fields)    \nA Hexo plugin that allows the default Markdown source files to be used as custom fields\n\n## Motive\n\nI am a front-end developer originally. I used many CMS throughout\nthe years and with many of them it was common to have custom fields.\nWhich is a functionality that allows the coder to be able to include just snippets\nof text or an image path into a template.\nI wanted to try a static-site generator more deeply and chose Hexo which I like so far.\nIt is just missing an easy way to include custom fields directly from\nyour Markdown source files.\nThat's exactly what this plugin is trying to solve!\n\n## Installation\n\nNPM\n```\nnpm install --save hexo-custom-fields\n```\n\nYarn\n```\nyarn add hexo-custom-fields\n```\n\n## Usage\n\nInsert the `custom_field()` tag in your templates (in this example with EJS):\n\n```\n\u003c%- custom_field('posts|pages, 'title_in_the_front_matter', 'name_of_the_field') %\u003e\n```\n\nArgument | Description\n-------- | -----------\nfirst     | 'posts' or 'pages' - this determines if the directory 'source/_posts' or 'source/' is used for that field - [Read more about the location in the Hexo documentation](https://hexo.io/docs/writing.html#Layout)\nsecond     |  'title' value in the front-matter of the Markdown source file - [Read more about the front-matter in the Hexo documentation](https://hexo.io/docs/front-matter.html)\nthird   |  the actual name of the chosen field. Below this table there is another one with possible options.\n\n\n**One can use the default fields provided by [Hexo](https://hexo.io/docs/variables.html#Page-Variables)**.\n**The most important options for the third argument are these:**\n\nOption   | Description\n-------- | -----------\n'any_field_name'    |  You can use an unlimited amount of custom fields in the front-matter of a source file. You can directly get these with their respective names - *string*\n'content'           |  The rendered content of the Markdown file (so everything after the front-matter) - *HTML*\n'title'             |  The given title - *string*\n'date'              |  The date and time the source file was created at - *formatted date (with timezone)*\n'updated'           |  The date and time the source file was last updated at - *formatted date (with timezone)*\n'permalink'         |  The full URL of the post or page - *URL*\n'_id'               |  The unique ID Hexo assigned to the source file - *string*\n\n\n**Example:**\n\nDisplay the custom field *'birthday'*\nfrom the Markdown source file *'front-page'*\nin the 'source' directory (which makes it a *'page'*)\n[Read more about the location in the Hexo documentation](https://hexo.io/docs/writing.html#Layout)\n```\n\u003c%- custom_field('pages', 'front-page', 'birthday') %\u003e\n```\n\n\nLicense\n-------\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floehnertz%2Fhexo-custom-fields","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floehnertz%2Fhexo-custom-fields","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floehnertz%2Fhexo-custom-fields/lists"}