{"id":22567826,"url":"https://github.com/fengzileo/wp-shortlink","last_synced_at":"2026-04-28T11:33:58.142Z","repository":{"id":263290595,"uuid":"889912281","full_name":"FengziLeo/wp-shortlink","owner":"FengziLeo","description":"基于Sink和wp插件实现文章分享短链","archived":false,"fork":false,"pushed_at":"2024-12-31T17:57:55.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-02T14:12:31.559Z","etag":null,"topics":["shortlink","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FengziLeo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-11-17T15:02:10.000Z","updated_at":"2024-12-31T17:57:58.000Z","dependencies_parsed_at":"2024-11-17T16:22:30.225Z","dependency_job_id":"770f2afe-6b29-4f8c-b37e-0b886953bfd8","html_url":"https://github.com/FengziLeo/wp-shortlink","commit_stats":null,"previous_names":["fengzileo/wp-shortlink"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FengziLeo%2Fwp-shortlink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FengziLeo%2Fwp-shortlink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FengziLeo%2Fwp-shortlink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FengziLeo%2Fwp-shortlink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FengziLeo","download_url":"https://codeload.github.com/FengziLeo/wp-shortlink/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246040952,"owners_count":20714093,"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":["shortlink","wordpress"],"created_at":"2024-12-08T00:09:21.012Z","updated_at":"2026-04-28T11:33:58.093Z","avatar_url":"https://github.com/FengziLeo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wp-shortlink\n基于Sink和wordpress插件实现文章短链分享\n\n## 示例\n[blog.fz.do](https://blog.fz.do)（可进入任意文章末尾查看）\n\n## 本内容适用情形\n1、dns服务商为Cloudflare（其他没测试过）；  \n2、一级域名不方便直接添加短链程序，如我的主页托管在CF pages；二级域名展示博客。\n\n## 优点\n1、可以将wp文章长链接缩短很多，使得便于分享且美观；  \n2、利用现有插件实现分享图标等内容的展示，避免重复造车；且Sink完成程度较高，功能全面，也避免再新写一个程序;  \n3、Sink存在同一链接会出现不同的短链，本代码也避免了该问题。\n\n## 使用\n1、根据[https://github.com/ccbikai/Sink](https://github.com/ccbikai/Sink)安装Sink，并完成配置；  \n2、WP安装插件sassy-social-share，后台在Miscellaneous中设置Url shortener为‘Use shortlinks already installed’；  \n3、打开example.com/wp-content/plugins/sassy-social-share/public目录下的class-sassy-social-share-public.php；  \n找到函数get_short_url，修改为code.php中的代码；找到同文件中的$horizontal_div，修改为code.php中的代码。并根据sql指令生成表。  \n4、进入cloudflare控制面板，进入对应的域名页面，从左侧规则进入重定向规则。  \n选择通配符模式，请求URL写为一级域名加“/*”，但是建议写成一级域名+“/s/*”，其中s可以任意替换，但是既然是短链，肯定还是一个字母为好，至于为什么要加一个路径，是为了避免访问主页在请求资源时被重定向；目标URL写为CF为Sink生成的域名+“/${1}”  \n这样就完成了请求example.com/s/2333重定向请求233.pages.dev/s/2333，再跳转目标网址，从而实现长链接转短链接。  \n\n## 注意\n1、code.php中请求头的部分要把pw替换为自己Sink后台的密码！！！  \n2、使用3中的第二步修改会导致统计链接不可用，请自行抉择！如果既想使用统计代码又不想使copy link返回长链接，可以尝试修改$post_url或js文件中获取链接的方式  \n\n## 缺点\n1、使用3中的第二步修改会导致统计链接不可用；  \n2、小屎山（）\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffengzileo%2Fwp-shortlink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffengzileo%2Fwp-shortlink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffengzileo%2Fwp-shortlink/lists"}