I can only get Jekyll to serve my blog in the root directory: localhost:4000
When I give a baseurl as shown below in my _config.yml, jekyll says it is serving my blog at http://0.0.0.0:4000/press, however, I can never reach it in my browser at localhost:4000/press.
# Site settings
title: Your Awesome Blog
email: your-email#domain.com
description: "Write an awesome description for your new site here"
baseurl: "/press"
url: ""
# Build settings
markdown: rdiscount
relative_permalinks: true
permalink: date
rdiscount:
extensions: [footnotes, autolink, smart]
Am I missing something?
Thank you! :)
0.0.0.0:4000 and localhost:4000 are not the same location.
You can use jekyll serve --host localhost or you can add a line with host: localhost to your _config.yml
Related
I have my previous site on https://vchrombie.github.io/ and I want my blog to be hosted on https://vchrombie.github.io/blog
I have created a new repository https://github.com/vchrombie/blog for this.
This is my configurations in _config.yml
# Dependencies
markdown: redcarpet
highlighter: pygments
# Permalinks
permalink: pretty
# Setup
title: vchrombie
tagline: 'A Jekyll theme'
description: 'A brazen two-column Jekyll theme that pairs a prominent sidebar with uncomplicated content. Made by #mdo.'
url: "http://vchrombie.github.io/blog"
baseurl:
disqus_shortname: vchrombie
author:
name: 'Venu'
url: https://vchrombie.github.io/
paginate: 10
plugins: [jekyll-paginate]
# Custom vars
appname: blog
version: 2.1.0
github:
repo: https://github.com/vchrombie/blog/
Everything is working fine in localhost but when I push the code to GitHub, I cannot actually load my blog.
What should I change to make my blog live?
This setup will work :
url: http://vchrombie.github.io
baseurl: /blog
I am using a docker-compose setup for a jeykll website:
version: '2'
services:
jekyll:
image: jekyll/jekyll:latest
command: jekyll serve --watch
ports:
- 4000:4000
volumes:
- ./www:/srv/jekyll
The website works, however when I access a directory I receive a directory listing:
I want the directory listing to redirect to my 404 page, however I cannot find the option to do this.
Can somebody explain how to do this with jekyll?
Install the jekyll redirect plugin:
Add this to Gemfile:
gem 'jekyll-redirect-from'
Then execute:
$ bundle
Add it to _config.yml:
gems:
- jekyll-redirect-from
Create the /404.html file or add the following front matter if you already have it:
---
title: 404 - Not Found
permalink: /404.html
redirect_from:
- /assets/
---
<p>HTTP 404 Not Found error message</p>
Pay attention to the trailing slash of /assets/ or it won't work.
Then each time you access /assets/ it will redirect to /404.html.
Just an update to the previous answer:
For recent versions of Jekyll, the way you have to add the plugin to the _config.yml file is as follows:
plugins:
- jekyll-redirect-from
Otherwise it won't work.
Source: https://github.com/jekyll/jekyll-redirect-from
Pretty permalinks are working file locally but not once deployed to GitHub Pages. Puzzled what might be a reason. Pages can be still accessed via .html.
_config.yml
title: Project Name
baseurl: /project-name
url: "http://organization-name.github.io"
google_analytics: # set tracking
gems:
- jekyll-redirect-from
exclude:
- Gemfile
- Gemfile.lock
permalinks: pretty
markdown: kramdown
Gemfile
source "https://rubygems.org"
ruby RUBY_VERSION
gem "github-pages", group: :jekyll_plugins
group :jekyll_plugins do
end
The right syntax is permalink: pretty : singular.
So I solved this issue by adding permalink explicitly to page meta. E.g.
permalink: /about/
Strange that it is not required locally.
You have to modify your _config.yml
defaults:
-
scope:
path: ""
type: "pages"
values:
permalink: "/:basename/"
You may want to tweak this example.
For example, if you want to keep your folder structure in your permalinks, you could have:
defaults:
-
scope:
path: ""
type: "pages"
values:
permalink: "/:path/:basename/"
Note: "pretty" is "/:path/:basename/"
My current _config.yml file looks like this:
#Site settings
...
baseurl: "" # the subpath of your site, e.g. /blog/
url: "http://10.0.1.9:3000" # the base hostname & protocol for your site
...
# Build settings
markdown: kramdown
safe: true
lsi: false
highlighter: true
keep_files: [public]
exclude: [src, lib, node_modules, bower.json, Gemfile, gulpfile.js, package.json, README.md]
I've got my url currently set to my local server, where I serve my Jekyll site for local development.
When building for production however, I have to keep manually changing this url to the url of my remote server before running jekyll build. Is there a way I can pass my remote url alongside the jekyll build command to build a site with the correct remote paths?
Something like so:
jekyll build --url mysite.com
Any help is appreciated with this. Thanks in advance!
Put your production url in _config.yml eg: url: toto.com.
Create a _config_dev.yml that will be used to override values in development.
In you case
url: "http://10.0.1.9:3000"
Development build is launched with :
jekyll build --config _config.yml,_config_dev.yml
Values in the last config file in the command will override those in first file.
and production build with jekyll build.
See Jekyll documentation http://jekyllrb.com/docs/configuration/#build-command-options configuration paragraphe.
I had a blog running at morenoh149.github.io I attempted to add yeoman to my workflow using jekyllrb generator. I followed the instructions by creating a new yeoman project, and copying over all the generated files and structure to my blog. But now github pages isn't picking up the blog. https://github.com/morenoh149/morenoh149.github.io
Anyone know how github pages works? the docs are sparse.
I changed the source in my yml file to app/ as well. So now when I run jekyll locally it works. But when I push to github pages it's not.
_config.yml
# Jekyll configuration precedence:
# 1. Gruntfile task
# 2. config.build.yml
# 3. config.yml
name: morenoh149.blog.yeoman
url: morenoh149.github.io
description: Harry Moreno has a blog
author:
name: Harry Moreno
email: morenoh149#gmail.com
# Grunt handles images and assets.
exclude: ['img', 'css', 'js', 'fonts',
'**.png', '**.jpg', '**.jpeg', '**.gif', '**.webp', '**.svg', '**.ico']
include: ['.htaccess']
source: app
# _config.build.yml sets future and show_drafts to false on `grunt build`
future: true
show_drafts: true
# Markdown library
markdown: redcarpet
# extensions: ['fenced_code_blocks', 'smart']
pygments: true
It looks like GitHub Pages is serving files from your site (for instance, http://morenoh149.github.io/app/ is an html file with a single paragraph element) but it's not serving them properly with all the Jekyll magic.
It turns out that GitHub Pages will override the source setting in the config file. This means that while you've specified source: app, it's looking at your top-level directory for content.
The solution is to move the contents of your app directory into your top-level directory.