{"id":13558388,"url":"https://github.com/arranf/HugoToJSON","last_synced_at":"2025-04-03T13:31:09.752Z","repository":{"id":53157290,"uuid":"165498956","full_name":"arranf/HugoToJSON","owner":"arranf","description":"A Rust utility to produce a JSON representation of the contents of a Hugo static site","archived":false,"fork":false,"pushed_at":"2021-04-03T22:57:42.000Z","size":171,"stargazers_count":29,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T22:45:26.617Z","etag":null,"topics":["hugo","index","json","lunr","lunrjs","rust","search"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/arranf.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":"2019-01-13T11:49:41.000Z","updated_at":"2024-09-22T09:50:37.000Z","dependencies_parsed_at":"2022-08-30T02:12:32.594Z","dependency_job_id":null,"html_url":"https://github.com/arranf/HugoToJSON","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arranf%2FHugoToJSON","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arranf%2FHugoToJSON/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arranf%2FHugoToJSON/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arranf%2FHugoToJSON/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arranf","download_url":"https://codeload.github.com/arranf/HugoToJSON/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247009548,"owners_count":20868567,"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":["hugo","index","json","lunr","lunrjs","rust","search"],"created_at":"2024-08-01T12:04:55.524Z","updated_at":"2025-04-03T13:31:09.237Z","avatar_url":"https://github.com/arranf.png","language":"Rust","funding_links":[],"categories":["Rust","json"],"sub_categories":[],"readme":"# HugoToJSON\n\n[![CircleCI](https://circleci.com/gh/arranf/HugoToJSON/tree/master.svg?style=svg)](https://circleci.com/gh/arranf/HugoToJSON/tree/master)\n[![Crate](https://img.shields.io/crates/v/hugo_to_json.svg)](https://crates.io/crates/hugo_to_json)\n\nA utility to produce a JSON representation of the key front matter and contents of Hugo documents. It's main intent is to produce JSON to be used by [Lunr](https://lunrjs.com/) (and [Lunr-like](http://elasticlunr.com/) packages) to support search on a static Hugo site. It's designed to be a fast and modern alternative to the now unsupported [hugo_lunr Node tool](https://www.npmjs.com/package/hugo-lunr).\n\nPull requests are welcome. A list of goals and work to be done is available in `ToDo.txt`.\n\nIt currently supports `.md` files and both YAML and TOML front matter.\n\n## Using\n`hugo_to_json HUGO_CONTENT_DIRECTORY -o OUTPUT_LOCATION`\n\nExample usage is shown below.\n`hugo_to_json example/blog/content -o example/blog/static/index.json`\n\nDefaults to `./content` for the content directory and stdout for the index output.\n\n## Fetching the Latest Version\n\nIf you want to use the latest version of this tool as part of a CI build process the following script should work.\n\n```bash\n#!/usr/bin/env bash\nset -e\n\n# Based on\n#https://blog.markvincze.com/download-artifacts-from-a-latest-github-release-in-sh-and-powershell/\n\nLATEST_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/arranf/HugoToJSON/releases/latest)\n# The releases are returned in the format {\"id\":3622206,\"tag_name\":\"hello-1.0.0.11\",...}, we have to extract the tag_name.\nLATEST_VERSION=$(echo $LATEST_RELEASE | sed -e 's/.*\"tag_name\":\"\\([^\"]*\\)\".*/\\1/')\nARTIFACT_URL=\"https://github.com/arranf/HugoToJSON/releases/download/$LATEST_VERSION/hugo_to_json\"\nINSTALL_DIRECTORY=\".\"\nINSTALL_NAME=\"hugo_to_json\"\nDOWNLOAD_FILE=\"$INSTALL_DIRECTORY/$INSTALL_NAME\"\n\n echo \"Fetching $ARTIFACT_URL..\"\nif test -x \"$(command -v curl)\"; then\n    code=$(curl -s -w '%{http_code}' -L \"$ARTIFACT_URL\" -o \"$DOWNLOAD_FILE\")\nelif test -x \"$(command -v wget)\"; then\n    code=$(wget -q -O \"$DOWNLOAD_FILE\" --server-response \"$ARTIFACT_URL\" 2\u003e\u00261 | awk '/^  HTTP/{print $2}' | tail -1)\nelse\n    echo \"Neither curl nor wget was available to perform http requests.\"\n    exit 1\nfi\n\nif [ \"$code\" != 200 ]; then\n    echo \"Request failed with code $code\"\n    exit 1\nfi\n\nchmod +x \"$DOWNLOAD_FILE\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farranf%2FHugoToJSON","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farranf%2FHugoToJSON","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farranf%2FHugoToJSON/lists"}