{"id":15626376,"url":"https://github.com/peter-evans/swagger-github-pages","last_synced_at":"2025-04-05T18:04:59.317Z","repository":{"id":32185783,"uuid":"131820427","full_name":"peter-evans/swagger-github-pages","owner":"peter-evans","description":"How to host Swagger API documentation with GitHub Pages","archived":false,"fork":false,"pushed_at":"2024-05-01T10:30:18.000Z","size":181893,"stargazers_count":411,"open_issues_count":0,"forks_count":116,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-02T02:15:27.660Z","etag":null,"topics":["api-documentation","github-pages","swagger","swagger-ui"],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/peter-evans.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}},"created_at":"2018-05-02T08:21:52.000Z","updated_at":"2024-05-07T11:27:00.681Z","dependencies_parsed_at":"2024-04-02T09:26:53.361Z","dependency_job_id":"71ec1ae9-668f-4b2b-8c8d-504fddd99869","html_url":"https://github.com/peter-evans/swagger-github-pages","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-evans%2Fswagger-github-pages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-evans%2Fswagger-github-pages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-evans%2Fswagger-github-pages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-evans%2Fswagger-github-pages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peter-evans","download_url":"https://codeload.github.com/peter-evans/swagger-github-pages/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378135,"owners_count":20929296,"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":["api-documentation","github-pages","swagger","swagger-ui"],"created_at":"2024-10-03T10:12:14.241Z","updated_at":"2025-04-05T18:04:59.294Z","avatar_url":"https://github.com/peter-evans.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# How to host Swagger API documentation with GitHub Pages\n[\u003cimg alt=\"The blog of Peter Evans: How to Host Swagger Documentation With Github Pages\" title=\"View blog post\" src=\"https://peterevans.dev/img/blog-published-badge.svg\"\u003e](https://peterevans.dev/posts/how-to-host-swagger-docs-with-github-pages/)\n\nThis repository is a template for using the [Swagger UI](https://github.com/swagger-api/swagger-ui) to dynamically generate beautiful documentation for your API and host it for free with GitHub Pages.\n\nThe template will periodically auto-update the Swagger UI dependency and create a pull request. See the [GitHub Actions workflow here](.github/workflows/update-swagger.yml).\n\nThe example API specification used by this repository can be seen hosted at [https://peter-evans.github.io/swagger-github-pages](https://peter-evans.github.io/swagger-github-pages/).\n\n## Steps to use this template\n\n1. Click the `Use this template` button above to create a new repository from this template.\n\n2. Go to the settings for your repository at `https://github.com/{github-username}/{repository-name}/settings` and enable GitHub Pages.\n\n    ![Headers](/screenshots/swagger-github-pages.png?raw=true)\n    \n3. Browse to the Swagger documentation at `https://{github-username}.github.io/{repository-name}/`.\n\n\n## Steps to manually configure in your own repository\n\n1. Download the latest stable release of the Swagger UI [here](https://github.com/swagger-api/swagger-ui/releases).\n\n2. Extract the contents and copy the \"dist\" directory to the root of your repository.\n\n3. Move the file \"index.html\" from the directory \"dist\" to the root of your repository.\n    ```\n    mv dist/index.html .\n    ```\n    \n4. Copy the YAML specification file for your API to the root of your repository.\n\n5. Edit [dist/swagger-initializer.js](dist/swagger-initializer.js) and change the `url` property to reference your local YAML file. \n    ```javascript\n        window.ui = SwaggerUIBundle({\n            url: \"swagger.yaml\",\n        ...\n    ```\n    Then fix any references to files in the \"dist\" directory.\n    ```html\n    ...\n    \u003clink rel=\"stylesheet\" type=\"text/css\" href=\"dist/swagger-ui.css\" \u003e\n    \u003clink rel=\"icon\" type=\"image/png\" href=\"dist/favicon-32x32.png\" sizes=\"32x32\" /\u003e\n    \u003clink rel=\"icon\" type=\"image/png\" href=\"dist/favicon-16x16.png\" sizes=\"16x16\" /\u003e    \n    ...\n    \u003cscript src=\"dist/swagger-ui-bundle.js\"\u003e \u003c/script\u003e\n    \u003cscript src=\"dist/swagger-ui-standalone-preset.js\"\u003e \u003c/script\u003e    \n    ...\n    ```\n    \n6. Go to the settings for your repository at `https://github.com/{github-username}/{repository-name}/settings` and enable GitHub Pages.\n\n    ![Headers](/screenshots/swagger-github-pages.png?raw=true)\n    \n7. Browse to the Swagger documentation at `https://{github-username}.github.io/{repository-name}/`.\n\n   The example API specification used by this repository can be seen hosted at [https://peter-evans.github.io/swagger-github-pages](https://peter-evans.github.io/swagger-github-pages/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-evans%2Fswagger-github-pages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeter-evans%2Fswagger-github-pages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-evans%2Fswagger-github-pages/lists"}