html – 检测当前页面URL的液体标记?

前端之家收集整理的这篇文章主要介绍了html – 检测当前页面URL的液体标记?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我刚刚开始使用Github来托管我的博客(使用Jekyll和Liquid)。但是,我有 an issue which I can’t currently fix.如果我能够检测到用户访问的“页面”或“url”,可能会被黑客攻击/解决问题。

就像是:

{% if user_is_currently_at_this_url %}
    {{ display something }}
{% else %}
    {{ display something else }}
{% endif %}

这可能吗?有没有其他方法解决这个问题?

解决方法

page.url是当前页面的URL,没有主机(例如/index.html),如 Page Variables所示。因此,在这种情况下:
{% if page.url == "/index.html" %}
   something
{% else %}
   other thing
{% endif %}

(但是,我不认为你需要这个,你的其他问题可能已经解决了:))

原文链接:https://www.f2er.com/html/232870.html

猜你在找的HTML相关文章