{"id":19886861,"url":"https://github.com/shen-yu/hugo-chart","last_synced_at":"2025-05-02T16:33:06.095Z","repository":{"id":39906450,"uuid":"299220500","full_name":"shen-yu/hugo-chart","owner":"shen-yu","description":"a Chart.js component for Hugo. :chart_with_upwards_trend:","archived":false,"fork":false,"pushed_at":"2023-05-17T16:11:34.000Z","size":117,"stargazers_count":101,"open_issues_count":4,"forks_count":19,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-07T03:41:18.973Z","etag":null,"topics":["chartjs","hugo","hugo-chart","hugo-theme","shortcode"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shen-yu.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}},"created_at":"2020-09-28T07:10:28.000Z","updated_at":"2025-01-30T07:36:25.000Z","dependencies_parsed_at":"2024-01-07T21:13:35.338Z","dependency_job_id":"43bfdda8-3e70-4544-8cf4-8763d006a23e","html_url":"https://github.com/shen-yu/hugo-chart","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shen-yu%2Fhugo-chart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shen-yu%2Fhugo-chart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shen-yu%2Fhugo-chart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shen-yu%2Fhugo-chart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shen-yu","download_url":"https://codeload.github.com/shen-yu/hugo-chart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252072121,"owners_count":21690167,"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":["chartjs","hugo","hugo-chart","hugo-theme","shortcode"],"created_at":"2024-11-12T17:39:49.186Z","updated_at":"2025-05-02T16:33:05.771Z","avatar_url":"https://github.com/shen-yu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hugo-chart\n\n[![Awesome](https://awesome.re/badge.svg)](https://github.com/budparr/awesome-hugo)\n\nEnglish | [中文说明](README_zh-CN.md)\n\n## About\n\nThis is not a standalone theme. It is a [Hugo](https://gohugo.io) theme component providing a shortcode: `chart` to display [Chart.js](https://www.chartjs.org/) in your Hugo site. \n\n![Screenshot](screenshots/1.png)\n\n## Usage\n\n1. Add the `hugo-chart` as a submodule to be able to get upstream changes later `git submodule add https://github.com/Shen-Yu/hugo-chart.git themes/hugo-chart`\n2. Add `hugo-chart` as the left-most element of the `theme` list variable in your site's or theme's configuration file `config.yaml` or `config.toml`. Example, with `config.yaml`:\n    ```yaml\n    theme: [\"hugo-chart\", \"my-theme\"]\n    ```\n    or, with `config.toml`,\n    ```toml\n    theme = [\"hugo-chart\", \"my-theme\"]\n    ```\n3. In your site, use the shortcode, this way:\n    ```go\n    {{\u003c chart [width] [height] \u003e}}\n    // Chartjs options goes here\n    {{\u003c /chart \u003e}}\n\n    ```\n\n    |  Name   | Type  | Default  | Description  |\n    |  ----  | ----  | ----  | ----  |\n    | width  | number | 100 | The width of chart, responsive in window (%).  |\n    | height  | number | 300 | The height of chart (px). |\n    \n4. Note that Chartjs is responsive as default, in order for the above code to correctly resize the chart height, the `maintainAspectRatio` option must be set to `false`.\n\n## Example\n\n```go\n{{\u003c chart 90 200 \u003e}}\n{\n    type: 'bar',\n    data: {\n        labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],\n        datasets: [{\n            label: 'Bar Chart',\n            data: [12, 19, 18, 16, 13, 14],\n            backgroundColor: [\n                'rgba(255, 99, 132, 0.2)',\n                'rgba(54, 162, 235, 0.2)',\n                'rgba(255, 206, 86, 0.2)',\n                'rgba(75, 192, 192, 0.2)',\n                'rgba(153, 102, 255, 0.2)',\n                'rgba(255, 159, 64, 0.2)'\n            ],\n            borderColor: [\n                'rgba(255, 99, 132, 1)',\n                'rgba(54, 162, 235, 1)',\n                'rgba(255, 206, 86, 1)',\n                'rgba(75, 192, 192, 1)',\n                'rgba(153, 102, 255, 1)',\n                'rgba(255, 159, 64, 1)'\n            ],\n            borderWidth: 1\n        }]\n    },\n    options: {\n        maintainAspectRatio: false,\n        scales: {\n            yAxes: [{\n                ticks: {\n                    beginAtZero: true\n                }\n            }]\n        }\n    }\n}\n{{\u003c /chart \u003e}}\n```\n\n![Bar chart](screenshots/2.png)\n\n## License\n\n[hugo-chart](https://github.com/Shen-Yu/hugo-chart) by [Eric Shen](https://github.com/Shen-Yu) is under [GPL v3](https://github.com/Shen-Yu/hugo-chart/blob/master/LICENSE) license.\n\n![visitors-count](https://visitor-badge.laobi.icu/badge?page_id=Shen-Yu.hugo-chart)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshen-yu%2Fhugo-chart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshen-yu%2Fhugo-chart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshen-yu%2Fhugo-chart/lists"}