如何为我的帖子设置自定义 URL 缩短程序?

发布于 2024-09-28 04:40:25 字数 1374 浏览 11 评论 0原文

我有几个不同的网站在 WordPress 上运行,并且 URL 往往变得相当长且麻烦(特别是当我尝试通过 Twitter 发布它们时)。我最近购买了一个非常短的域名,我想将其用作个人 URL 缩短服务的根。

所以...

  • http://www.eamann.com/portfolio 将变成 http://eam.me/portfolio
  • http://www.mindsharestrategy .com/wp-xmlrpc-movabletype/ 将变为 http://eam.me/df3DF
  • http://www.prosepainting.com/coffee-shop-part- 1/ 将变为 http://eam.me/csp1
  • 以及诸如 https://wordpress.stackexchange.com/questions/3076/feature-survey-what 之类的自定义内容-would-you-want-in-a-resume-theme 会变成 http://eam.me/wpa3076

基本上,我想设置和管理我自己的 TinyURL-like服务器...但有一些特定的要求:

  1. 它应该与 WordPress 完全集成,这样我就可以在创建页面或帖子时动态创建新的短 URL(我在每个站点上创建的每条内容都应该有自己的短 URL)。
  2. 我可以指定是否希望 URL 是随机的(例如 /df3Df),或者我可以在创建 URL 时选择一个唯一的字符串(例如 /wpa3076
  3. )应该能够从 WordPress 中查看/编辑/管理数据库中的 URL

目前,我倾向于像 YOURLS 存在于自己的数据库中。我面临的问题(我现在承认我还没有尝试过)是将系统与 WordPress 完全集成。我希望每个帖子在我点击“发布”之前自动建议一个简短的 URL,然后在我最终“发布”该帖子时自动创建该 URL。我还想管理使用该服务的每个网站中的所有链接。

这可能吗?是否已经有解决方案可以做到这一点?如果没有,我该从哪里开始?

(交叉发布到 WordPress 答案)

I have several different sites running off WordPress, and the URLs tend to get fairly long and cumbersome (particularly when I try to publish them via Twitter). I recently purchased a very short domain name, and I'd like to use it as the root of a personal URL shortening service.

So ...

  • http://www.eamann.com/portfolio would become http://eam.me/portfolio
  • http://www.mindsharestrategy.com/wp-xmlrpc-movabletype/ would become http://eam.me/df3DF
  • http://www.prosepainting.com/coffee-shop-part-1/ would become http://eam.me/csp1
  • And custom things like https://wordpress.stackexchange.com/questions/3076/feature-survey-what-would-you-want-in-a-resume-theme would become http://eam.me/wpa3076

Basically, I want to set up and manage my own TinyURL-like server ... but with some specific requirements:

  1. It should integrate fully with WordPress so I can dynamically create new short URLs whenever I create a page or a post (every piece of content I create on each site should have its own short URL).
  2. I can specify if I want the URL to be random (like /df3Df) or I can choose a unique string instead (like /wpa3076) at the time of URL creation
  3. I should be able to view/edit/manage the URLs I have in the database from within WordPress

At the moment, I'm leaning towards a standalone system like YOURLS that lives in its own database. The problem I'm facing (and I'll confess now that I haven't attempted it yet) is integrating the system fully with WordPress. I want each post to automatically suggest a short URL before I hit "publish" and then automatically create the URL when I finally do "publish" the post. I'd also like to administer all of my links from within each of the sites using the service.

Is this even possible? Is there already a solution around to do this? If not, where do I start?

(Cross-posted to WordPress Answers)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

画骨成沙 2024-10-05 04:40:25

YOURLS 的作者之一在 WordPress 社区非常活跃,因此 YOURLS 确实有一个“官方”插件来将其与 WordPress 集成。该插件在 YOURLS 网站和 在 Ozh 的网站上,也可以在 WordPress 插件目录中找到,如 awats 提到的。

不幸的是,虽然 YOURLS 支持自定义短 URL 关键字,但该插件似乎不支持从 WordPress 管理员指定这些自定义关键字。
然而 YOURLS API 确实为此提供了一个接口,因此扩展插件以支持此功能似乎相对简单。

我建议联系 Ozh(该插件的作者和共同作者)或 YOURLS 本身,并询问他是否会考虑将该功能添加到插件中。
如果没有,您可以自己分叉插件并添加功能(或花钱请其他人来做),当然您也必须承担维护分叉的责任。

One of the authors of YOURLS is very active in the WordPress community, and so YOURLS does indeed have an "official" plugin to integrate it with WordPress. The plugin is described on the YOURLS site and on Ozh's website, and can also be found in the WordPress plugin directory as awats mentioned.

Unfortunately, although YOURLS supports custom short URL keywords, the plugin doesn't seem to support specifying these custom keywords from the WordPress admin.
However the YOURLS API does make an interface for this available and so it would seem to be relatively trivial to extend the plugin to support this feature.

I recommend contacting Ozh, author of the plugin and coauthor or YOURLS itself, and asking if he will consider adding the feature to the plugin.
If not you could fork the plugin and add the feature yourself (or pay someone else to do do), though then of course you also have to take on the responsibility of maintaining your fork.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文