{"id":15287894,"url":"https://github.com/stackbit/sourcebit-target-hugo","last_synced_at":"2026-02-14T21:02:45.961Z","repository":{"id":56253873,"uuid":"239987491","full_name":"stackbit/sourcebit-target-hugo","owner":"stackbit","description":"A Sourcebit plugin for the Hugo static site generator","archived":false,"fork":false,"pushed_at":"2025-11-18T14:01:59.000Z","size":139,"stargazers_count":2,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-01-19T18:46:38.713Z","etag":null,"topics":["gohugo","headless","headless-cms","hugo","sourcebit","ssg"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/sourcebit-target-hugo","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/stackbit.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-02-12T10:39:34.000Z","updated_at":"2024-08-05T13:19:12.000Z","dependencies_parsed_at":"2026-01-19T14:04:07.720Z","dependency_job_id":null,"html_url":"https://github.com/stackbit/sourcebit-target-hugo","commit_stats":null,"previous_names":["stackbithq/sourcebit-target-hugo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stackbit/sourcebit-target-hugo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbit%2Fsourcebit-target-hugo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbit%2Fsourcebit-target-hugo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbit%2Fsourcebit-target-hugo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbit%2Fsourcebit-target-hugo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackbit","download_url":"https://codeload.github.com/stackbit/sourcebit-target-hugo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackbit%2Fsourcebit-target-hugo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29455601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["gohugo","headless","headless-cms","hugo","sourcebit","ssg"],"created_at":"2024-09-30T15:39:25.650Z","updated_at":"2026-02-14T21:02:45.944Z","avatar_url":"https://github.com/stackbit.png","language":"JavaScript","readme":"# sourcebit-target-hugo\n\n[![npm version](https://badge.fury.io/js/sourcebit-target-hugo.svg)](https://badge.fury.io/js/sourcebit-target-hugo)\n\n\u003e A [Sourcebit](https://github.com/stackbithq/sourcebit) plugin for the [Hugo](https://gohugo.io/) static site generator\n\n## 👩‍🏫 Introduction\n\nThis plugin writes content from any Sourcebit data source into files compatible with the Hugo static site generator.\n\n## 🏗 Installation\n\nTo install the plugin and add it to your project, run:\n\n```\nnpm install sourcebit-target-hugo --save\n```\n\n\u003e 💡 You don't need to run this command if you start Sourcebit using the [interactive setup process](#%EF%B8%8F-interactive-setup-process), as the CLI will install the plugin for you and add it as a dependency to your project.\n\n## ⚙️ Configuration\n\nThe plugin accepts the following configuration parameters. They can be supplied in any of the following ways:\n\n-   In the `options` object of the plugin configuration block inside `sourcebit.js`, with the value of the _Property_ column as a key;\n-   As an environment variable named after the _Env variable_ column, when running the `sourcebit fetch` command;\n-   As part of a `.env` file, with the value of the _Env variable_ column separated by the value with an equals sign (e.g. `MY_VARIABLE=my-value`);\n-   As a CLI parameter, when running the `sourcebit fetch` command, using the value of the _Parameter_ column as the name of the parameter (e.g. `sourcebit fetch --my-parameter`).\n\n| Property           | Type     | Visibility | Default value | Env variable | Parameter | Description                                                                                                                                                                                                                                                   |\n| ------------------ | -------- | ---------- | ------------- | ------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `fullAssetObjects` | Boolean  | Public     | `false`       |              |           | By default, values of fields that reference assets will be written as a string containing just the asset URL. To get a full [asset object](https://github.com/stackbithq/sourcebit/wiki/Data-normalization#assets) instead, set `fullAssetObjects` to `true`. |\n| `writeFile`        | Function | Public     |               |              |           | A function that computes the files to be created, as well as their location, format and contents (see below for more details).                                                                                                                                |\n\nThe `writeFile` function is invoked on each entry from the `objects` data bucket, with the following parameters:\n\n-   `entry` (Object): An entry from the `objects` data bucket\n-   `utils` (Object): An object containing utility methods:\n    -   `slugify` (Function): Creates a filename-friendly version of any string (e.g. `utils.slugify('Hello, Sourcebit friends!') === 'hello-sourcebit-friends'`)\n\nThe return value of this function determines whether the entry being evaluated will be written to a file and, if so, defines the path, the format and the contents of the file.\n\nTo write a file for an entry, the return value should be an object with a `content`, `format` and `path` properties. The nature of these properties may vary slightly based on the value of `format`, as shown in the table below.\n\n| `format`         | `content`                                                                                                                               | `path`                                                         | Description                                     |\n| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | ----------------------------------------------- |\n| `frontmatter-md` | Object containing a `frontmatter` and `body` properties, which will be written to the file's frontmatter and content body, respectively | The absolute path to the file. Must end with `.md`.            | Writes a Markdown file with a YAML frontmatter. |\n| `yml`            | Object to be written as YAML                                                                                                            | The absolute path to the file. Must end with `.yaml` or `.yml` | Writes a YAML file.                             |\n| `json`           | Object to be written as JSON                                                                                                            | The absolute path to the file. Must end with `.json`.          | Writes a JSON file                              |\n\n\u003e 💡 If you wish to create multiple files for an entry, set the return value to an array of objects, each containing a `content`, `format` and `path` properties.\n\n### 👀 Example configuration\n\n_sourcebit.js_\n\n```js\nmodule.exports = {\n    plugins: [\n        {\n            module: require('sourcebit-target-hugo'),\n            options: {\n                writeFile: function(entry, utils) {\n                    const { __metadata: meta, ...fields } = entry;\n\n                    if (!meta) return;\n\n                    const { createdAt = '', modelName, projectId, source } = meta;\n\n                    if (modelName === 'post' \u0026\u0026 projectId === '123456789' \u0026\u0026 source === 'sourcebit-source-contentful') {\n                        const { __metadata, content, layout, ...frontmatterFields } = entry;\n\n                        return {\n                            content: {\n                                body: fields['content'],\n                                frontmatter: { ...frontmatterFields, layout: fields['layout'] }\n                            },\n                            format: 'frontmatter-md',\n                            path: 'content/posts/' + createdAt.substring(0, 10) + '-' + utils.slugify(fields['title']) + '.md'\n                        };\n                    }\n                }\n            }\n        }\n    ]\n};\n```\n\n### 🧞‍♂️ Interactive setup process\n\nThis plugin offers an interactive setup process via the `npx create-sourcebit` command. It asks users to categorize each of the content models present in the `models` data bucket as a page or data object. For each model selected, the user is asked to define the location and the source of different frontmatter values.\n\n## 📥 Input\n\nThis plugin expects the following data buckets to exist:\n\n-   `models`: An array of content models\n-   `objects`: An array of content entries\n\n## 📤 Output\n\nThis plugin creates files on disk, in locations and with formats defined by the `writeFile` function.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackbit%2Fsourcebit-target-hugo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackbit%2Fsourcebit-target-hugo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackbit%2Fsourcebit-target-hugo/lists"}