Hosting jekyll to Google App engine

Nosakhare Belvi

Built a personal blog using jekyll. Everything works well on local host. I do not want to deploy it on github. I prefer hosting on google app engine for some reasons.

I followed some instructions online and copied _site folder generated to my google app engine project.

this is how app.yaml looks like:

application: myblog
version: 1
runtime: python27
api_version: 1
threadsafe: yes

error_handlers:
- file: /404.html

handlers:

- url: /
  static_files: _site/index.html
  upload: _site/index.html

- url: /(.*)
  static_files: _site/\1
  upload: _site/(.*)


libraries:
- name: webapp2
  version: "2.5.2"

when i run it locally on google app engine, only the index.html and some other files displays. others shows page not found. Is there anything I am not implementing properly ?

Nosakhare Belvi

Well, I finally figure it out. It is a little trick anyway.

First in your _config.yaml file add:

permalink:         /posts/:title/index.html

after that, run jekyll serve to generate the static file in _site folder. Copy the the post folder to _site/ in your app engine project.

Then, in your _config.yaml file change permalink to:

permalink:         /posts/:title

run jekyll serve to generate the static file in _site. Copy the entire files generated excluding posts folder into _site/ into your app engine project.

then, make your appengine app.yaml look somewhat like this:

application: myblog
version: 1
runtime: python27
api_version: 1
threadsafe: yes


handlers:
- url: /(.*\.js)
  mime_type: text/javascript
  static_files: _site/\1
  upload: _site/(.*\.js)

- url: /(.*\.(jpg|png|ico))
  static_files: _site/\1
  upload: _site/(.*\.img)

- url: /(.*\.css)
  mime_type: text/css
  static_files: _site/\1
  upload: _site/(.*\.css)

- url: /(.*\.(eot|svg|svgz|otf|ttf|woff|woff2))
  static_files: _site/\1
  upload: _site/(.*\.fonts)

- url: /
  static_files: _site/index.html
  upload: _site/index.html

- url: /(.+)/
  static_files: _site/\1/index.html
  upload: _site/(.+)/index.html
  expiration: "15m"

- url: /(.+)
  static_files: _site/\1/index.html
  upload: _site/(.+)/index.html
  expiration: "15m"

- url: /(.*)
  static_files: _site/\1
  upload: _site/(.*)

#- url: /((tags)|(archive)|(about)|(posts)|(fonts))/

libraries:
- name: webapp2
  version: "2.5.2"

see example for clarification

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related