hahagood 最近的时间轴更新
hahagood

hahagood

V2EX 第 668 号会员,加入于 2010-07-20 09:26:08 +08:00
hahagood 最近回复了
49 天前
回复了 kaiki 创建的主题 问与答 如何让非程序员能轻松使用 hexo 发布文章
一直很头痛这个问题.
曾经幻想过有一种发邮件提交 github 的方法. 遍寻不果.
@alexkuang
太对了.
刚才问了下 ChatGPT, 他也是这么说的. 哈哈....
我不知道在这儿怎么贴代码, ChatGPT 有些例程的

Yes, it is possible to use JavaScript to display a random post on the homepage of your Hugo + Cloudflare + GitHub blog site. Here is an example of how you can do this:

First, you will need to create a list of all the posts that you want to be included in the random selection. You can do this by querying the Hugo API for a list of all your posts and storing the results in a JavaScript array.

Next, you will need to write a function that selects a random post from the array of posts. This can be done using the Math.random() function to generate a random number, and then using this number to select a random post from the array.

Finally, you will need to call this function whenever the homepage is refreshed. This can be done using the window.onload event in JavaScript, which is triggered whenever the page is loaded.
@dimlau
这个真的不错. 棒...
受上面的启发, 找到了一篇文章, 正在慢慢琢磨. (因为我不懂代码. 哈...)
https://dev.to/idontremember/add-a-random-page-button-to-hugo-site-45e9
Add a Random Page Button to Hugo Site - DEV Community 👩‍💻👨‍💻
@dimlau
刚才测试了一下. 似乎这一段代码的作用, 是在我运行
'''
hugo server -D
'''
的时候, 才会进行排序, 而不是在浏览器端刷新页面的时候重新排序.
我需要的是在每次打开页面的时候, 都会随机出现一个完整的页面. 不是-摘要-
@dimlau
多谢多谢. 实在是太有用了.
我想做一个编故事的网站,
每次打开主页, 都会随机展示一个以前已经发布的故事.
所以就不需要 summary. 只要展示一篇完整的故事就可以了.
这儿的"summary", 是不是可以换成"content"?
2022-12-19 13:12:58 +08:00
回复了 itechnology 创建的主题 程序员 不想自己搭博客,有没有什么推荐的第三方博客平台?
hugo + cloudflare + github
非常方便, 十分钟就弄好了.
hugo 的模板也非常多. 可以随便试.
唯一还没有弄明白的是如何删除一篇不需要的 post. 现在的办法就是在 cloudflare 里把整个项目重建. 也不是不行.
2022-01-27 14:36:17 +08:00
回复了 VincentWang 创建的主题 Linux 腾讯出了 Linux 版微信~
无论是官方的 win 版, 还是 UOS 版,都没有找到调整暗色主题的方法. 是我没发现吗?
@shilianmlxg 多谢多谢.现在已经改用了声笔简码.
请教一下, 在小鹤音形里, ℃的符号在哪儿的? (刚学小鹤第二天)
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5400 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 06:58 · PVG 14:58 · LAX 23:58 · JFK 02:58
Developed with CodeLauncher
♥ Do have faith in what you're doing.