Simplest Jekyll Website on Bitbucket - what am I missing?


#1

I am trying to host a basic website on bitbucket.io using the feature described here. I just learned Jekyll today, so I think I am missing something extremely basic.

When I test my sample website locally using Jekyll serve on my local machine, it works and I can navigate between different pages, etc, at localhost:4000 as mentioned on the Jekyll website.

Now, I want to push this to bitbucket. I followed the instructions given by bitbucket and if I push to the bitbucket repository a basic “hello world” code palced inside index.html, it works - I can navigate to username.bitbucket.io/index.html and the text appears like it should.

However, if I do the same with a Jekyll website - i.e. I have a Jekyll website that works locally, and I push the entire directory containing the site (after running jekyll build) to the Bitbucket repository - I see non-formatted html such as:

15%20PM

instead of the formatted text. You can tell that it’s simply implementing all the text in the file without doing any Jekyll magic on it.

The source for the page is, predictably:
---
layout: default
title: Blog
---
"<h1>Latest Posts</h1>"

<ul>
  {% for post in site.posts %}
    <li>
      <h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
      <p>{{ post.excerpt }}</p>
    </li>
  {% endfor %}
</ul>

What step am I missing here? When/where does the jekyll build or jekyll serve need to happen, for the site to be rendered correctly on Bitbucket?


#2

it sounds like you uploaded the source to bitbucket. Bitbucket does not automatically build jekyll sites for you like Github does. It sounds like if you used GH it would work.

If you want to serve the site via BitBucket you can probably commit the _site folder which is where the rendered html files are. That may work. But you would need to build the site locally any time you wanted to make a change.

Or google jekyll bitbucket and read how people do it using pipelines or some other build tool.


#3

Is there a reason to use BB instead of GH? there is also Gitlab which has support for jekyll, though neither will be as easy as GH.


#4

Hmm, okay - I’ll try commiting only the _site directory and see if that works.

No particular reason for using Bitbucket instead of github except that I use Bitbucket for my other projects. I just assumed it would be equally possible in Bitbucket, but if it becomes too difficult I’ll switch to GH.

If I commit a Jekyll directory (such as, for example, I can do by doing jekyll new test1) to a github pages repository, then will GH run jekyll every time I commit changes to my files?


#5

Jekyll was created by one of the GH founders, so it is baked into GH but not any of the others.

I use BB for most of my stuff as it is private, but I host via AWS S3 which is practically free for my purposes. But GH is a very simple process as it is all integrated really well.

I am pretty sure you can do it on BB you just need to use a pipeline to process it. I can do it on Gitlab but it was a bit of a learning curve.


#6

Thanks! I saw ‘pipelines’ somewhere when I was Googling this, but didn’t pursue it much.

It looks like hosting on Amazon is quite cheap if I don’t get much traffic or have a lot of data, so I may end up taking that route too.