This is the source code of my personal Persian website. Persian aka Farsi is written right-to-left, however some people use Roman script to write Persian language in messaging applications and social networks.
This repository can be of use to anybody willing to build a new right to left website. I gradually fix issues which I came across while writing new posts in my website. This website is produced using Jekyll static site generator.
Having a comment section on a truely static website (a bunch of documents indeed) is impossible. For HTML forms should be handled on a server. This website used Disqus in the beginning, then Netlify forms and now a CGI script on my own self-hosted server. The script stores submissions in a sqlite3 database. See the schema.sql for the data model. The build script exports comments from the sqlite3 database into data files. These files in turn are used to generate the static comments upon page builds.
I use nginx and fcgiwrap for running the script. Some environment variables are necessary, such as database location and a simple value as puzzle solution.
The latest comment section uses a CGI script along with a sqlite3 database. For running CGI scripts I used fcgiwrap. After installation on Ubuntu I enabled the fcgiwrap.service
. I use the following block to handle cgi-bin
path on nginx:
location /cgi-bin/ {
gzip off;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include /etc/nginx/fastcgi_params;
fastcgi_param ALEF_DB "/path/to/my/sqlite/db";
fastcgi_param ALEF_PUZZLE "puzzle_answer";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
The comment form submits a POST request to cgi-bin/submit
URL which will be handle by this script. The scripts/rebuild_commends.py
is updated to rebuild comments from the sqlite3 database. The path should be available at ALEF_DB
env variable. See the Makefile for the build commands.
Take the following steps to make your own website:
username.github.io or username.github.io/repository_name). 4. Edit _config.yml to reflect your information 5. Move _posts/* contents to _drafts/* or delete them (you can use them as template) 6. Edit _includes/footer.html and edit feedburner and validation links. Alternatively you can delete any link that you don't like. To use feedburner you have to setup an account there for your website. 7. Write your awesome stories :heart:
In order to build the website correctly, you have to name the forked repository different from your username. If you put it under a repository like yourusername.github.io Github will use its own Jekyll builder to build your website, no matter what you put inside gh-pages branch. Happy writing!