hexo每次远程部署会变动文章更新日期解决方案
踩坑配置了update_option: mtime和order_by: -updated,实现文章按最后修改日期排序,但每次部署完发现都会有个hello world不合时宜地出现在最上面😓 打开发现大部分文章的修改日期都变成了同一个——部署的日期,而自己加了updated参数的不受影响,疑似git本身对文件修改日期的判定机制导致。
于是乎,给每个文章都添加了updated参数,例如
12345---title: Hello Worlddate: 2023-01-01 00:00:00updated: 2023-02-01 00:00:00---
勉强解决,但每次都手动添加太麻烦了。
完美解决方案修改格式模板在文章模板中添加updated参数到Front-matter(修改/scaffolds/post.md),如下
123456---title: {{ title }}date: {{ date }}tags:updated: {{ date } ...
本站自动部署workflow
用于github actions自动部署hexo
非本人原创,网上找来改改就用上了👌
原代码会queued,将ubuntu版本改为latest解决了
1234567891011121314151617181920212223242526272829303132333435363738394041name: Hexo Deployon: push: branches: - masterjobs: build: runs-on: ubuntu-latest if: github.event.repository.owner.id == github.event.sender.id steps: - name: Checkout source uses: actions/checkout@v2 with: ref: master - name: Setup Node.js uses: actions/setup-node@v1 with: n ...
js应在dom加载完成再操作元素
省流:放到body下面或者套上window.onload()
情景修改flarum时,在后台自定义页眉html代码包了块script写js,通过getElementsByClassName(' ')来获取某指定类的标签的对象,遍历检测是否包含特定文本,再修改其文字内容,然而没有生效。💩
原代码:
123456789101112131415161718<script>console.log("test001");var elements = document.getElementsByClassName('TagLabel-name');// 遍历这些元素for (var i = 0; i < elements.length; i++) { console.log("test002"); // 获取当前元素的文本内容 var text = elements[i].textContent || elements[i].innerText; // 检查文本内容是否为'W ...
Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick StartCreate a new post1$ hexo new "My New Post"
More info: Writing
Run server1$ hexo server
More info: Server
Generate static files1$ hexo generate
More info: Generating
Deploy to remote sites1$ hexo deploy
More info: Deployment