You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

基于当前URL条件加载Tumblr受限页面或正常页面的实现方案问询

基于当前URL条件加载Tumblr受限页面或正常页面的实现方案问询

我现在有个Tumblr博客的需求想请教大家:当用户访问我的博客根域名(blog-name.tumblr.com)时,我希望他们看到一个伪装的受限页面,页面里藏着一个指向blog-name.tumblr.com/page/1的隐藏链接,点击后才能进入真正的博客主页。同时,博客的其他链接比如/post、/tagged这类都要保持正常可用。

目前我已经准备好两段HTML代码:

  • 受限页面的代码
  • 正常博客的代码

我的核心问题:有没有办法根据当前访问的URL(是根域名本身,还是带有任何后缀路径的URL)来条件触发加载其中一段代码呢?

受限页面的HTML代码

<style>
  body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #36465d;
    color: white;
    font-family: "Helvetica Neue", Arial, sans-serif;
    font-size: 18px;
    font-weight: bold;
    margin: 0;
    text-align: center;
  }

  a {
    color: #36465d;
    /* hidden link, same color as background */
    text-decoration: none;
    font-size: 8px;
  }

  .gif-container {
    margin-top: 20px;
    /* space and then gif for distraction */
  }

  img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
  }
</style>

<div class="restricted-message">
  <p>This blog is private.</p>
  <p><a href="https://blog-name.tumblr.com/page/1">.</a></p> <!-- 修正了原代码中多余的</span>标签 -->
  <div class="gif-container">
    <img src="gif.gif" alt="Private Page GIF">
  </div>
</div>

另外,正常博客的HTML代码篇幅较长(约2000行),就是标准的自定义Tumblr博客HTML模板,这里就不贴出来了。

备注:内容来源于stack exchange,提问作者Barbara Perez de Araújo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 12:57:58