Skip to main content

Using Pagefind with 11ty in Termux

Also see previous blog post on how I got started with eleventy on Termux


The Pagefind npm package is just a wrapper for their binary. It does not work on Termux. What I had to do was build from source using

cargo install pagefind

The documentation for Pagefind is pretty useful and I started here


I got the following error when building with cargo

error occurred: Failed to find tool. Is 'aarch64-linux-android-ar' installed?

I found out that I had to install binutils

pkg install binutils

As it instructs you, make sure and add the bin folder to path so that you can run the pagefind command

export PATH=/data/data/com.termux/files/home/.cargo/bin:$PATH

The two things I needed was data-pagefind-body and data-pagefind-ignore because I only wanted the poem content to be indexed and because I deploy to github pages I had to specify baseUrl

The pagefind command that I used was as follows

pagefind --source "../docs/poems" --glob "**/*.*"

And because I am using pagefind to insert its javascript and css and other files after the 11ty build, I needed to ignore the build when launching in browser.

npx @11ty/eleventy --serve --ignore-initial

This is the result on github pages.


Initially github pages was not serving the css and js for pagefind. I figured out what was causing the problem. The pagefind folder begins with an underscore which is treated special by Jekyll. Jekyll is on by default on github pages. I had to turn this off by deploying a .nojekyll file to the root of my website.

Comments

Popular posts from this blog

Kickstarter for Trinidad

It is Saturday before Christmas and the beginning of the long weekend. The place where I live is extremely quiet. There are hardly any cars on the road. I ate my breakfast and I am surfing the web. Then I came across Kickstarter and I started asking questions. Mainly, can Trinidadians use Kickstarter? Are Trinidadians using Kickstarter? Do we need a Kickstarter type website for Trinidad and Tobago/Caribbean? There is fundmetnt but the idea is not the same. Kickstarter is for creatives and you are creating a tangible deliverable that is shared with backers. Also there is a vetting process. Fundmetnt is more akin to gofundme. I went to the Kickstarter website and I filtered by Trinidad and Tobago and only 17 projects were returned and many of them dated. This is not much. I contacted @kickstarter on Twitter and asked them "Hi. Can Trinidadians 🇹🇹 use Kickstarter? Will they be able to get the funds to their local bank?". I will also send an email. I will also send an email to ...

Google Pay in Trinidad

Update : It is prepaid and credit cards not debit. Linx on facebook said that the Linx machines do not fascilitate Google Pay.

Stop and stare at the crotons

It is 147pm. I just woke up from a nap. I had Sunday lunch which was chicken soup. My mobile phone does not have much charge left. I decided to write. What can I write about? I asked my mom what to write about. She said to write about flowers plants. She wants flowers in the yard. Flowers are beautiful. Flowers are attractive. Flowers are calming. Flowers are part of God's creation. I am reminded of the saying that we should stop and smell the roses. We should appreciate the now. Learn from the past, plan for the future but live in the now. I asked my mom why she likes flowers? She says it is therapy for the mind, it helps her to elevate her spirits and it makes the place look beautiful. That is flower power I would say. My favorite plant is the croton. I love passing through the countryside, especially in Tobago, and seeing the rich croton plants. Crotons are flowers-like I would say. Let us say they are pseudo flowers plants because of the mixture of colors on the leaves that see...