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

编写

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

在layouts/partials/head.html中添加

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

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

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

使用

1{{<hide_and_seek>}}
2普通信息
3{{</hide_and_seek>}}
4
5{{<hide_and_seek>}}
6<strong>Hello</strong> 

7{{</hide_and_seek>}}

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

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

普通信息 Hello

除另有声明外本博客文章均采用 知识共享 (Creative Commons) 署名 4.0 国际许可协议 进行许可转载请注明原作者与文章出处