ShortLinks - Typecho外链转内链插件

有时候我们为了减少权重的流失,或者是为了隐藏某些推荐链接(比如:淘宝客、主机推荐),因此需要将外链转化为内链。ShortLinks就是一款Typecho的外链转内链插件,支持正文和评论者链接。

shortlinks-logo

简单介绍

它能把外部链接转换为 your_blog_path/go/key/这样的路径,右键上面的链接点击复制链接地址,就是类似这样的格式,并且可以自定义短链、统计点击信息。

  1. 支持 referer 白名单和外链转换白名单
  2. 支持跳转页面,可以自行制作模板放到 templates 目录下,插件设置里可选择,目前自带 5 个模板
  3. 支持自定义字段转换(实验性功能,开启强制转换后更好用)
  4. 支持关闭指定页面的链接转换功能。添加自定义字段 noshort 即可
  5. 支持前台渲染插件(实验性功能,插件设置中开启强制转换)

自建模板

在看别人博客的时候发现了一个不错的跳转动画,这里直接做成单独页面来作为ShortLinks的模板使用。新建一个html文件粘贴下面内容,如果有需要替换一下favicon.ico的地址,然后将文件放到插件的 templates 目录下即可。

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width">
    <meta name="robots" content="noindex, nofollow">
    <meta http-equiv="refresh" content="{{delay}};url='{{url}}';">
    <meta charset="UTF-8">
    <link rel="shortcut icon" href="https://www.example.com/favicon.ico">
    <title>页面加载中,请稍候...</title>
    <style>*{margin:0;padding:0;}#PageLoading{height:100%;width:100%;position:fixed;margin-top:0px;top:0px;}#PageLoading-center{width:100%;height:100%;position:relative;}#PageLoading-center-absolute{position:absolute;left:50%;top:50%;height:200px;width:200px;margin-top:-100px;margin-left:-100px;}.object{-moz-border-radius:50% 50% 50% 50%;-webkit-border-radius:50% 50% 50% 50%;border-radius:50% 50% 50% 50%;position:absolute;border-left:5px solid #87CEFA;border-right:5px solid #FFC0CB;border-top:5px solid transparent;border-bottom:5px solid transparent;-webkit-animation:animate 2.5s infinite;animation:animate 2.5s infinite;}#object_one{left:75px;top:75px;width:50px;height:50px;}#object_two{left:65px;top:65px;width:70px;height:70px;-webkit-animation-delay:0.1s;animation-delay:0.1s;}#object_three{left:55px;top:55px;width:90px;height:90px;-webkit-animation-delay:0.2s;animation-delay:0.2s;}#object_four{left:45px;top:45px;width:110px;height:110px;-webkit-animation-delay:0.3s;animation-delay:0.3s;}@-webkit-keyframes animate{50%{-ms-transform:rotate(180deg);-webkit-transform:rotate(180deg);transform:rotate(180deg);}100%{-ms-transform:rotate(0deg);-webkit-transform:rotate(0deg);transform:rotate(0deg);}}@keyframes animate{50%{-ms-transform:rotate(180deg);-webkit-transform:rotate(180deg);transform:rotate(180deg);}100%{-ms-transform:rotate(0deg);-webkit-transform:rotate(0deg);transform:rotate(0deg);}}</style>
</head>
<body>
<div id="PageLoading">
    <div id="PageLoading-center">
        <div id="PageLoading-center-absolute">
            <div class="object" id="object_four"></div>
            <div class="object" id="object_three"></div>
            <div class="object" id="object_two"></div>
            <div class="object" id="object_one"></div>
        </div>
    </div>
</div>
</body>
</html>

外部参考

https://github.com/benzBrake/ShortLinks
https://xxi.icu/archives/207.html

评论区
头像
文章目录