Change Hugo Default lastmod Date

Today I found that even if I set lastmod date manually in my hugo post front matter, the content last modified date still pulls from .GitInfo.AuthorDate, Which is a different than my expectation. If lastmod is set, I thought it should have the highest priority. Dug a little in hugo documentation, The .Lastmode variable is for the date the content was last modified and it pulls from the lastmod field in a content’s front matter.

Restore Heroku Postgres Database Locally

It would be nice to operate against the same set of data on your local machine with your heroku postgres server. Heroku made this a breeze. Create a new backup on heroku 1 heroku pg:backups:cature Note Use --app <appname> to specify which app to backup. By default, backup operates against primary database, identified by the DATABASE_URL config var. Append database name in the end to choose which database to backup.

Deploy Wagtail/Django to Heroku with Github

Once you’ve created an awesome local website with wagtail or django framwork, you’ll want to make it pulic to everybody or somebody over the internet. There are dozens of hosting providers that actively support with django. I am not going to discuss pros and cons for different hosting vendors in this post. Heroku is the platform I choose for my little wagtail project so I’ll just focus on how to deploy wagtail project to heroku here.

Manage Django Development and Production Settings

While django makes it easy to get an application up and running locally, the default setting is unsuitible for production use. It is a good practice to break down the default settings.py module into multiple files to seperate development settings and production settings. Basic structure An empty new django site looks like this: 1 2 3 4 5 6 7 mysite/ |-- mysite/ | |-- __init__.py | |-- settings.

Change Git Default Branch Name

All git repositories used to use the master as the branch name, but it was changed to main since October, 2020. Here are steps to change default branch name for existing projects. 1. Change the branch name locally 1 git branch -m master main -m option is used to rename the branch name with all of the commit history transfer to new branch. 2. Push new branch to remote upstream 1 git push -u origin main -u option is used to set the upstream

React Controlled vs Uncontrolled Components

According to the official react docs: In a controlled component, form data is handled by a React component. The alternative is uncontrolled components, where form data is handled by the DOM itself. A more intuitive way to explain this concept is that controlled components take their current values through props and handle their changes through callback functions.

Use Gatsbyjs with MDX and Latex Equations

I am using Gatsbyjs for a while and really love it to generate static sites. With the help of gatsby-transformer-remark plugin, It is a pleasure to transform Markdown files to HTML. I built a documentation site in production and this blog site for personal use, they both run well and serve their own purposes. However, the whole content will depend on Markdown syntax, which was invented to be simple. It wasn’t enough for some people, many new features were added to Markdown like flow chart support, latex equation support, table support, etc.