Firestore Pagination

Cloud Firestore, aka Firestore, is an NoSQL database released by Google on October 2017, currently it is on beta stage. It’s the successor of old Firebase database (Realtime Database), and in my opinion, the biggest change would be querying. Firestore allows you to do query based on multiple fields, which is very useful to handle data.

When I was carrying out my project Iridescent, I realized that I needed to paginate data. As the project grows up, I can’t load 100+ data all by once. Firestore has a daily limit for document reads and bandwidth, so I have to try to reduce the usage.

At the same time, a long waiting time is not part of good user experience, and loading all data by once might cause lag on low-performance devices.

Continue reading “Firestore Pagination”

Disqus2WP

Update: this tool does not work anymore due to Disqus’ export format change (GDPR), which removed commenter’s IP address and Email.

I had been using Ghost on 2015 ~ 2017. It’s a good blogging-platform, but it doesn’t have a built-in comment system, so I had to use a third-party comment service, which is Disqus.

Disqus isn’t a bad platform, in fact, I think it’s a great solution for those who doesn’t want to spend a lot of time investigating how to avoid spams or maintaining. At the same time, it has some great features like “Real time comments” or voting.

Except the loading speed.

Continue reading “Disqus2WP”

Hugo 获取文章特色图片

静态博客基本上都支持 Front Matter,用来添加标题、日期、标签等等信息,但也可以用来储存别的数据。同样的功能也能在 WordPress 和 Typecho 上找到。(自定义字段)

从Hugo内置的 Opengraph.html 模板中可以看出,官方想让我们使用的字段是 images ,用来添加多张特色图片。不过由于历史原因,我还是习惯使用 image 来添加单张图片。

Continue reading “Hugo 获取文章特色图片”

Hugo 本地搜索

静态博客的搜索功能实现基本上可以分为两种:第一种是生成所有数据,客户端下载这些数据并进行搜索;第二种是借助第三方服务来进行索引,并返回匹配的数据。

前一种实现起来很简单,毕竟不需要研究第三方API。但如果需要搜索的数据非常大,或者是客户端的性能不够就容易导致卡顿。

这篇文章就写写第一种在Hugo上的实现方法好了。

Continue reading “Hugo 本地搜索”