{"id":15044074,"url":"https://github.com/voxpelli/node-jekyll-utils","last_synced_at":"2025-09-13T01:31:51.010Z","repository":{"id":9834432,"uuid":"63494055","full_name":"voxpelli/node-jekyll-utils","owner":"voxpelli","description":"A collection of Jekyll utilility methods to generate eg. Jekyll permalinks and slugs","archived":false,"fork":false,"pushed_at":"2024-12-29T04:33:12.000Z","size":54,"stargazers_count":8,"open_issues_count":12,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-29T05:21:53.737Z","etag":null,"topics":["jekyll","node-js","permalink","slugs"],"latest_commit_sha":null,"homepage":null,"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/voxpelli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["voxpelli"]}},"created_at":"2016-07-16T17:15:23.000Z","updated_at":"2023-05-15T19:41:02.000Z","dependencies_parsed_at":"2024-02-27T02:46:20.193Z","dependency_job_id":"8b0b54b4-1e64-494f-9f16-8305fc6488d3","html_url":"https://github.com/voxpelli/node-jekyll-utils","commit_stats":{"total_commits":85,"total_committers":3,"mean_commits":"28.333333333333332","dds":0.4,"last_synced_commit":"5857381e59fbdce275a766ffb2fcfd4cdc912a98"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Fnode-jekyll-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Fnode-jekyll-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Fnode-jekyll-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpelli%2Fnode-jekyll-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voxpelli","download_url":"https://codeload.github.com/voxpelli/node-jekyll-utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232806888,"owners_count":18579334,"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","node-js","permalink","slugs"],"created_at":"2024-09-24T20:50:02.486Z","updated_at":"2025-01-07T00:54:15.285Z","avatar_url":"https://github.com/voxpelli.png","language":"JavaScript","readme":"# Jekyll Utils\n\n[![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg?style=flat)](https://github.com/Flet/semistandard)\n\nA collection of Jekyll utilility methods to generate eg. Jekyll permalinks and slugs\n\n## Requirements\n\nRequires at least Node.js 10.x\n\n## Installation\n\n```bash\nnpm install jekyll-utils --save\n```\n\n## API Usage\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### slugify\n\n-   **See: [Mimicked Jekyll Code](https://github.com/jekyll/jekyll/blob/9278eb8fcec85b17573c6658d7d67ef6ea6ffb92/lib/jekyll/utils.rb#L177)**\n\nSlugify a filename or title.\n\nWhen mode is \"none\", return the given string.\n\nWhen mode is \"raw\", return the given string,\nwith every sequence of spaces characters replaced with a hyphen.\n\nWhen mode is \"default\" or nil, non-alphabetic characters are\nreplaced with a hyphen too.\n\nWhen mode is \"pretty\", some non-alphabetic characters (.\\_~!$\u0026'()+,;=@)\nare not replaced with hyphen.\n\nIf cased is true, all uppercase letters in the result string are\nreplaced with their lowercase counterparts.\n\n#### Parameters\n\n-   `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the string to create a slug of\n-   `mode` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** how string is slugified. Can be set to \"default\", \"pretty\" or \"raw\" (optional, default `default`)\n-   `cased` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** – whether to keep the character casing or not (optional, default `false`)\n\n#### Examples\n\n```javascript\nslugify('The _config.yml file')\n// =\u003e 'the-config-yml-file'\n```\n\n```javascript\nslugify('The _config.yml file', 'pretty')\n// =\u003e 'the-_config.yml-file'\n```\n\n```javascript\nslugify('The _config.yml file', 'pretty', true)\n// =\u003e 'The-_config.yml file'\n```\n\nReturns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the slugified string\n\n### generateUrl\n\n#### Parameters\n\n-   `template` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The String used as template for URL generation,\n    for example \"/:path/:basename:output_ext\", where\n    a placeholder is prefixed with a colon. Or one of the predefined styles \"pretty\", \"none\", \"date\" or \"ordinal\". (optional, default `date`)\n-   `jekyllResource` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** A representation of a Jekyll resource such as a Post or a Page\n    -   `jekyllResource.basename_without_ext` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The file basename without the file extension.\n    -   `jekyllResource.date` **([Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) \\| [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number))** The published date of the resource\n    -   `jekyllResource.data` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** The resource document's data\n        -   `jekyllResource.data.categories` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\u0026lt;[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)\u003e?** The categories specified on the document\n        -   `jekyllResource.data.slug` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The slug specified on the document\n\n\n-   Throws **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** if not all needed placeholders are found\n\nReturns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the String URL\n\n### JekyllUrl\n\n-   **See: [Mimicked Jekyll Code](https://github.com/jekyll/jekyll/blob/cc82d442223bdaee36a2aceada64008a0106d82b/lib/jekyll/url.rb)**\n\nMethods that generate a URL for a resource such as a Post or a Page.\n\n#### Parameters\n\n-   `options` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** One of :permalink or :template must be supplied.\n    -   `options.template` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The String used as template for URL generation,\n        or example \"/:path/:basename:output_ext\", where\n        a placeholder is prefixed with a colon.\n    -   `options.null` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** :placeholders - A hash containing the placeholders which will be\n        replaced when used inside the template. E.g.\n        { year: (new Date()).getFullYear() } would replace\n        the placeholder \":year\" with the current year.\n    -   `options.permalink` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** If supplied, no URL will be generated from the\n        template. Instead, the given permalink will be\n        used as URL.\n\n#### Examples\n\n```javascript\nnew JekyllUrl({\n  template: '/:categories/:title.html',\n  placeholders: {':categories': 'ruby', ':title' =\u003e 'something'}\n}).toString();\n```\n\n#### toString\n\nGenerates the relative URL of the resource\n\n-   Throws **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** if the relative URL contains a colon\n\nReturns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the String URL\n\n#### generated_permalink\n\nGenerates a URL from the permalink\n\nReturns **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) \\| `false`)** the unsanitized String URL\n\n#### generated_url\n\nGenerates a URL from the template\n\nReturns **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) \\| `false`)** the unsanitized String URL\n\n#### sanitize_url\n\n##### Parameters\n\n-   `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** an unsanitized String URL\n\nReturns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a sanitized String URL, stripping \"../../\" and multiples of \"/\",\nas well as the beginning \"/\" so we can enforce and ensure it.\n\n#### escape_path\n\nEscapes a path to be a valid URL path segment\n\n##### Parameters\n\n-   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The path to be escaped.\n\n##### Examples\n\n```javascript\nJekyllUrl.escape_path('/a b')\n// =\u003e '/a%20b'\n```\n\nReturns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the escaped path.\n","funding_links":["https://github.com/sponsors/voxpelli"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpelli%2Fnode-jekyll-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoxpelli%2Fnode-jekyll-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpelli%2Fnode-jekyll-utils/lists"}