Showing posts with label Jekyll. Show all posts
Showing posts with label Jekyll. Show all posts

Saturday, September 14, 2019

Disqus Complaining "Content Security Policy" Error on Jekyll Webite

I was building a website using Jekyll with the Minima theme. Following the instruction of the Minima theme, I set up Disqus to posts on the site by adding the "Disqus shortname" to Jekyll site configuration file _config.yml, such as,


disqus:
    shortname: mysite-short-name

However, the site displays an error message,

We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
When I clicked on the error message, Disqus shows an error message

Content Security Policy error
It turns out that to make Disqus work, we must include a url attribute in the configuration file, i.e., after I added the attribute, the configuration now includes,

url: https://mysite-url-used-for-disqus
disqus:
    shortname: mysite-short-name

Tuesday, August 27, 2019

Jekyll Complains "GitHub Metadata: No GitHub API authentication could be found."

When building a Jekyll site, I encountered the following error message,


$ bundle exec jekyll build
Configuration file: _config.yml
            Source: foosite/
       Destination: _site
 Incremental build: disabled. Enable with --incremental
      Generating...
   GitHub Metadata: No GitHub API authentication could be found. 
   Some fields may be missing or have incorrect data.


The sources of this error are many. What caused the error in my case? It is actually the combination of the two facts:

  1. I used the Jekyll SEO Tags plugin, and
  2. I did not include a description value in the _config.yml file. 

After my adding a description map to the _config.yml file, the problem went away, e.g.,

$ cat _config.yml
...
description: this is my awesome site. 
...

Wednesday, August 7, 2019

Installing Jekyll on Windows 10 with Windows Subsystem for Linux

Following the Jekyll document, I installed Jekyll on Windows 10 with Windows System for Linux. The steps were as follows:

  1. Enable Windows Subsystem for Linux following Microsoft's documentation, i.e., 
    1. In Windows 10, open PowerShell as Administrator.
    2. Run the following in PowerShell

      Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
      

    3. Restart Windows
  2. Download and install a Linux distribution from Microsoft Store by opening the following URL in a Web browser: https://aka.ms/wslstore
  3.  Open a Windows Command Prompt window, and run

    bash
    

  4. Run the following in bash
    
    sudo apt-get update -y && sudo apt-get upgrade -y
    sudo apt-get install -y --no-install-recommends software-properties-common gnupg gpg-agent dirmngr 
    sudo apt-add-repository ppa:brightbox/ruby-ng
    sudo apt-get update
    sudo apt-get install -y ruby2.5 ruby2.5-dev build-essential dh-autoreconf zlib1g-dev
    sudo apt-get install bundler
    sudo gem update
    

  5. Assume you have a Jeykll site at the www directory. Then go to the directory in bash
    
    cd www
    

  6. In bash, run the following
    
    cd www
    bundle update
    bundle install
    
  7. Build the site and launch the Web serer for testing.
    
    bundle exec jekyll serve --host=0.0.0.0 --incremental
    

Saturday, November 5, 2016

Setting up Jekyll on Ubuntu 16.04

I recently set up Jekyll 3 on Ubuntu 16.04. The procedure is simple, works on Ubuntu 14.04, and perhaps also works on other versions of Ubuntu and other Linux distributions.


  1. Create a directory for your Jekyll site. For instance, let us call it "mysite".
    
           mkdir mysite
        
  2. Go to the site directory, and create a file called "Gemfile". The file defines Ruby applications dependencies. Since Jekyll is a Ruby application. This file defines the dependencies for Jekyll. It is quite simple, and the following shell command will create the file with sufficient content.
    
           cd mysite
           echo "source 'https://rubygems.org'" > Gemfile
           echo "gem 'execjs'" >> Gemfile
           echo "gem 'therubyracer'" >> Gemfile
           echo "gem 'github-pages', group: :jekyll_plugins" >> Gemfile
        
  3. Now install Ruby and other necessary packages.
    
           sudo apt-get install ruby ruby-dev ruby-bundler zlib1g-dev build-essential
        


  4. Finally, install Jekyll and its dependencies. On the site directory where Gemfile is, do the following,
    
           bundle install
        
  5. To build the Jekyll site, do the following on the site directory,
    
           bundle exec jekyll build
        
  6. You can serve the site by the following command,
    
           bundle exec jekyll serve --host=127.0.0.1 --port=4000