Moving from WordPress, hosting questions

For the last couple of years I’ve had a WordPress blog. Recently I discovered Jekyll and love it, so I want to convert WP -> J. I have been able to do this mostly, though I still haven’t been able to get a lightbox working yet, but that’s not the point of this post just background info.

I have done the development/conversion locally using Gulp to process the css, js & images. I would like to host the Jekyll site at the same hosting I currently have. The converted site does use some gems, one that I wrote is physically in the _plugins directory and others have been installed via the command line.

Now the questions:

1> Hosting: In the _site directory I see no reference to the gems, has their code been “absorbed” into the _site directory? Any documentation I have read so far is either angled towards GitHub hosting or says just upload the contents of the _site directory. Does the hoster need to be Ruby aware?

2> Permalinks: On the WP blog I used the Jekyll equivalent of /:title. Using this in Jekyll puts every post and page in a directory in the root - ugly… I would much prefer to keep posts in one directory and pages in another but keep the same permalink setup. Is this doable? If so how?

3> Page location: Related to the last point, I have all my pages in a _pages directory, but when Jekyll does it’s thing they end up in the root of the _site directory. How do I “move” them into into a “pages” directory and keep the same permalink structure?

4> 404 Page: I have created the 404.html page and it is in the root. When I try to access a no-existing page the 404 does not appear locally. Should it? What do I need to do to “see” it both locally and when I upload the site?

The _site folder is where Jekyll puts your compiled site. If the structure there is not what you want then you’ll need to play with permalinks and what not.

What GitHub Pages and hosting like it are doing is building your site from the files in the root of your project. They fire up a jekyll build and then publish the same files that would ultimately end up in _site.

The reason you’re not seeing any gems in _site is because that’s the compiled site. It doesn’t include any of the bits Jekyll uses to actually build your site (configs, gems, plugins, layouts, includes, source MD, etc.).

Does that help clear things up?

RE: 404 pages. How those are served up will depend on the type of hosting you’re using. For example I host on an Apache server and had to add a line to my .htaccess file to tell it to use my custom 404.html page.

Hosting: The _site directory contains the generated static website. GitHub Pages will either generate the same site if you give it the source files and a _config.yml and then serve the generated website to you, or will directly serve the website if you give it just the generated contents in _site.
The host needs to be Ruby-aware if you plan to have it build the site and serve it for you. The host would then need to have a version of Jekyll-gem installed along with any plugins required. This is easily achieved by using Bundler and a Gemfile.

Permalinks & URLs: Permalinks determine the directory structure of the generated website. You can’t have posts and pages segregated by using the same permalink structure in WP.
By such segregation, the URLs change too. e.g. A page about.html will now be accessible as /pages/about.html

404 Page: A 404.html at the root of _site will be used by the WEBrick server automatically when you serve with Jekyll. For production servers, different rules apply.

thx mmistakes :slight_smile:
I guess I knew that, as in Gulp I had to point browser-sync to the _site directory to see the result of Jekyll’s work. But that last comment about ‘the compiled site’ totally clarified it to me, thank you.

thx ashmaroli :slight_smile:

Hosting: I shall be compiling locally and uploading to my hosting as this will give me the freedom to use any gems I might need.

Permalinks & URLs: Since my initial posting I have decided to put the posts in an articles directory so their url will be /articles/:title. I shall leave the pages in the root. I think this is a fair compromise.

404 Page: As I said I’m using Gulp to do the heavy lifting, it makes a call to only jekyll build, and browser sync is used to show the _site. So I guess I’m outta luck there.

RE: 404 pages: Would you mind sharing that line mmistakes? I realise it may be a little different to what I need even though the site will be on apache hosting, but it will give me a ballpark to aim for. I could throw the _site dir into Mamp and play with the .htaccess there before uploading.

Sure thing. Here’s the line from my .htaccess

# Customize what Apache returns to the client in case of an error.

ErrorDocument 404 /404/

I have a file with permalink: /404/ which builds as _site/404/index.html

Ha…I thought it was going to be harder than that :wink: as I haven’t need to mess with .htaccess before, thx again mmistakes.