2023-08-05  2024-09-18    228 字  1 分钟

编写

将js文件放在主题的static/js文件夹中,css文件放在主题的static/css文件夹中

在layouts/partials/head.html中添加

    <script src="/js/hide_and_seek.js"></script>
    <link rel="stylesheet" href="/css/hide_and_seek.css">

编写hide_and_seek.html放在layouts/shortcodes/文件夹中

<!-- layouts/shortcodes/hide_and_seek.html -->
<hide_and_seek>{{ .Inner }}</hide_and_seek>

使用

{{<hide_and_seek>}}
普通信息
{{</hide_and_seek>}}

{{<hide_and_seek>}}
<strong>Hello</strong> 

{{</hide_and_seek>}}

隐藏的内容在两条分割线之间,若想查看请按照以下方法操作

  • 电脑:上上下下左右左右BABA (上下左右请使用方向键
  • 手机:上上下下左右左右 (上下左右请使用触屏

普通信息 Hello