{"id":21879576,"url":"https://github.com/xiexianbin/gseo","last_synced_at":"2026-05-10T09:52:46.317Z","repository":{"id":38416690,"uuid":"469341069","full_name":"xiexianbin/gseo","owner":"xiexianbin","description":"从Google Search Console获取关键字，自动渲染Hugo MarkDown文件。Auto Render Hugo markdown keywords from Google Search Console.","archived":false,"fork":false,"pushed_at":"2022-06-04T14:19:30.000Z","size":3096,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-26T18:32:15.398Z","etag":null,"topics":["golang","google-search-api","google-search-console","hugo","seo"],"latest_commit_sha":null,"homepage":"https://www.xiexianbin.cn/s/gseo","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/xiexianbin.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":"2022-03-13T10:44:10.000Z","updated_at":"2023-04-07T13:16:58.000Z","dependencies_parsed_at":"2022-09-13T06:50:21.597Z","dependency_job_id":null,"html_url":"https://github.com/xiexianbin/gseo","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiexianbin%2Fgseo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiexianbin%2Fgseo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiexianbin%2Fgseo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiexianbin%2Fgseo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xiexianbin","download_url":"https://codeload.github.com/xiexianbin/gseo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244885696,"owners_count":20526296,"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":["golang","google-search-api","google-search-console","hugo","seo"],"created_at":"2024-11-28T08:17:33.587Z","updated_at":"2026-05-10T09:52:41.285Z","avatar_url":"https://github.com/xiexianbin.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gseo\n\n[![build-test](https://github.com/xiexianbin/gseo/actions/workflows/workflow.yaml/badge.svg)](https://github.com/xiexianbin/gseo/actions/workflows/workflow.yaml)\n[![GoDoc](https://godoc.org/github.com/xiexianbin/gseo?status.svg)](https://pkg.go.dev/github.com/xiexianbin/gseo)\n[![Go Report Card](https://goreportcard.com/badge/github.com/xiexianbin/go-actions-demo)](https://goreportcard.com/report/github.com/xiexianbin/go-actions-demo)\n\na golang client to optimize [hugo](https://www.xiexianbin.cn/tags/hugo/) seo by Google Search Console. read [gseo spec](./docs/specification.md) for more information.\n\n## Install\n\n- source\n\n```\ngo install github.com/xiexianbin/gseo\n```\n\n- bin\n\n```\ncurl -Lfs -o gseo https://github.com/xiexianbin/gseo/releases/latest/download/gseo-{linux|darwin|windows}\nchmod +x gseo\n./gseo\n```\n\n## Usage\n\n### show help\n\n- root help\n\n```\n$ gseo -h\n golang client to optimize [hugo](https://www.xiexianbin.cn/tags/hugo/) seo by Google Search Console.\n\nUsage:\n  gseo [flags]\n  gseo [command]\n\nAvailable Commands:\n  completion  Generate the autocompletion script for the specified shell\n  help        Help about any command\n  init        init gseo configure\n  keyword     show site keywords\n  render      render hugo post markdown files\n  sites       site list\n  version     Print the version number of gseo.\n\nFlags:\n  -h, --help      help for gseo\n  -v, --verbose   debug info.\n\nUse \"gseo [command] --help\" for more information about a command.\n```\n\n- keywords help\n\n\n```\n$ gseo help keyword\ndownload hugo post keywords from Google Search Console API, and cache it in `./.gseo/` dir\n\nUsage:\n  gseo keyword [flags]\n\nFlags:\n  -h, --help          help for keyword\n  -l, --last int      last days (default 90)\n  -s, --site string   site url\n```\n\n- render help\n\n```\n$ gseo help render\nrender hugo post markdown files.\ndefault args is:\n  gseo render --content PATH_OF_HUGO_CONTENT --position 10 --ctr 0 --impressions 100 --clicks 0.3 --max 8 --dryrun\n\nUsage:\n  gseo render [flags]\n\nFlags:\n  -k, --clicks float        \u003e=clicks to render seo.\n      --content string      hugo content path\n  -c, --ctr float           ctr = clicks / impressions to render seo, and 0 \u003c= ctr \u003c= 1. (default 0.3)\n  -r, --dryrun              dry run mode.\n  -h, --help                help for render\n  -i, --impressions float   \u003e=impressions to render seo. (default 100)\n  -m, --max int             max seo items, -1 is un-limit. (default 8)\n  -p, --position float      \u003e=position to render seo. (default 10)\n  -s, --skip-err            skip error. (default true)\n```\n\n### how to get Google Search Console API token\n\n- step-1: config google auth secret in file `~/.gseo/client_secret.json` (can i build it as constant in go pkg?)\n\n```\n$ cat ~/.gseo/client_secret.json\n{\"installed\":{\"client_id\":\"1017408311257-hq3j99vk9ludpoff862mnp52v36nv4gc.apps.googleusercontent.com\",\"project_id\":\"adept-button-344010\",\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"token_uri\":\"https://oauth2.googleapis.com/token\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\",\"client_secret\":\"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\",\"redirect_uris\":[\"urn:ietf:wg:oauth:2.0:oob\",\"http://localhost\"]}}\n```\n\n- step-2: init google token\n\n```\n$ gseo init\nPlease enter Google API client_secret.json path (default is /Users/xiexianbin/.gseo/client_secret.json):\ninit config success!\nGo to the following link in your browser then type the authorization code:\nhttps://accounts.google.com/o/oauth2/auth?access_type=offline\u0026client_id=1017408311257-hq3j99vk9ludpoff862mnp52v36nv4gc.apps.googleusercontent.com\u0026redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob\u0026response_type=code\u0026scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fwebmasters.readonly\u0026state=state-token\n---\u003e \u003cVisit the URL above, and paste the (authorization code/授权代码) over here\u003e \u003c---\nSaving credential file to: /Users/xiexianbin/.gseo/token.json\ninit Google API OAuth2.0 token success!\n```\n\n### Demo\n\n- list sites\n\n```\n$ gseo sites\nPermissionLevel  SiteUrl\nsiteOwner        sc-domain:xiexianbin.cn\nsiteOwner        https://docs.xiexianbin.cn/\nsiteOwner        https://www.xiexianbin.cn/\n```\n\n- show special site keywords, while write keywords to cache file `~/.gseo/cache-\u003cdate\u003e.json`\n\n```\n$ gseo keyword -s \"https://www.xiexianbin.cn/\"\n==\u003e get 1000 lines Results\n==\u003e get 1000 lines Results\nWrite to file /Users/xiexianbin/.gseo/cache-2022-06-03.json success, bytes 276427\n```\n\n- render demo, read keywords from cache file `~/.gseo/cache-\u003cdate\u003e.json`\n\n```\n$ export HUGO_CONTENT=\"/Users/xiexianbin/workspace/code/github.com/xiexianbin/note.seo/content\"\n\n# default args\n$ gseo render --content ${HUGO_CONTENT} --position 10 --ctr 0 --impressions 10 --clicks 0.1 --max 8 --dryrun true\n\n# my args 1 **\n$ gseo render --content ${HUGO_CONTENT} --position 10 --ctr 0 --impressions 100 --clicks 0.3 --max 8\n\n# my args 2 *****\n$ gseo render --content ${HUGO_CONTENT} --position 0 --ctr 0 --impressions 1 --clicks 0 --max 8 --dryrun true\n```\n\nnow, you can find seo keywords has auto update/render to `${HUGO_CONTENT}`.\n\n## Action\n\n- keyword can not contain `:`, occur golang yaml parse err\n\n## arch\n\n[Hugo 博客 SEO 优化 - 自动调用 Google Search Console API](https://www.xiexianbin.cn/open-sources/google-search-console-render-hugo-post/index.html)\n\n## dev\n\n```\n# run some TestCase\ngo test -v -run TestClient google/client_test.go\n\n# build\n$ make all\n```\n\n## ref\n\n- https://developers.google.com/webmaster-tools/about\n- https://developers.google.com/webmaster-tools/v1/api_reference_index\n- [Quickstart: Run a Search Console App in Python](https://developers.google.com/webmaster-tools/v1/quickstart/quickstart-python)\n  - [Search Console APP Dashboard](https://console.cloud.google.com/apis/api/cloudsearch.googleapis.com/overview)\n- [Search Console Testing Tools API (Experimental)](https://developers.google.com/webmaster-tools/search-console-api)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiexianbin%2Fgseo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxiexianbin%2Fgseo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiexianbin%2Fgseo/lists"}