129 lines
6.0 KiB
HTML
129 lines
6.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>2022-09-20 How to create a static website with Jekyll and deploy it on GitHubPages</title>
|
|
<link rel="stylesheet" href="/assets/css/styles.css">
|
|
</head>
|
|
<body>
|
|
<nav>
|
|
|
|
<a href="/website/index.html" >Home</a>
|
|
|
|
<a href="/website/about.html" >About</a>
|
|
|
|
<a href="/website/blog.html" >Blog</a>
|
|
|
|
</nav>
|
|
<h1>2022-09-20 How to create a static website with Jekyll and deploy it on GitHubPages</h1>
|
|
<p>20 Sep 2022 - Aaron</p>
|
|
|
|
<section>
|
|
<p>Install <a href="https://git-scm.com/downloads" target="_blank">Git</a></p><br>
|
|
<p>Install <a href="https://www.ruby-lang.org/en/documentation/installation/" target="_blank">Ruby</a></p><br>
|
|
<p>
|
|
Install Jekyll and Bundler<br>
|
|
<code>$ gem install jekyll bundler</code><br>
|
|
</p>
|
|
<p>
|
|
Create a <a href="https://github.com/" target="_blank">GitHub-account</a><br>
|
|
Create a <a href="https://github.com/new" target="_blank">repository on GitHub</a><br>
|
|
(It has to be public if you use GitHub Free, note that your code will be visible to everyone!)<br>
|
|
</p>
|
|
<p>
|
|
Clone the repository to a local directory:<br>
|
|
<i>SSH</i><br>
|
|
<code>$ git clone --recursive SSH_URL</code><br>
|
|
<i>HTTPS</i><br>
|
|
<code>$ git -c http.sslVerify=false clone --recursive HTTPS_URL</code><br>
|
|
</p>
|
|
<p>
|
|
Create two directories: docs and localDev.<br>
|
|
<div>
|
|
<code>$ mkdir docs</code><br>
|
|
<code>$ mkdir localDev</code><br>
|
|
</div>
|
|
docs will contain the content of the website later on.<br>
|
|
localDev will contain our Jekyll project.<br>
|
|
</p>
|
|
<p>
|
|
Move to the localDev-directory:<br>
|
|
<div>
|
|
<code>$ cd localDev</code><br>
|
|
</div>
|
|
</p>
|
|
<p>
|
|
Create a new Jekyll-project at localDev-directory:<br>
|
|
<div>
|
|
<code>$ jekyll new --skip-bundle .</code><br>
|
|
(make sure you got the dot)<br>
|
|
</div>
|
|
</p>
|
|
<p>
|
|
Open the Gemfile that Jekyll created and comment out the line which starts with <i>gem "jekyll"</i><br>
|
|
Add the github-pages gem by editing the line starting with # gem "github-pages".<br>
|
|
Change this line (# gem "github-pages") to:<br>
|
|
<i>gem "github-pages", "~> GITHUB-PAGES-VERSION", group: :jekyll_plugins</i><br>
|
|
You can find the actual version of GitHub-pages <a href="https://rubygems.org/gems/github-pages" target="_blank">here</a><br>.
|
|
Now save and close the Gemfile.<br>
|
|
</p>
|
|
<p>
|
|
Now still being at the localDev-directory, install the bundle:<br>
|
|
<div>
|
|
<code>$ bundle install</code><br>
|
|
</div>
|
|
Optionally you can make changes at the <i>_config.yml</i> file.<br>
|
|
</p>
|
|
<p>
|
|
Follow <a href="https://jekyllrb.com/docs/step-by-step/01-setup/#create-a-site" target="_blank">this</a> guide to learn Jekyll. Make sure that all files and directories you create are in the localDev-directory.<br>
|
|
Note that building locally will not work according to commenting out gem "Jekyll" at the Gemfile. (Atm I didn't check if you can let it in and bundle install to allow local building)<br>
|
|
</p>
|
|
<p>
|
|
After creating all necessary files and dirs, you can make a production build:<br>
|
|
Note that all files at _site will be cleared!
|
|
<div>
|
|
<code>$ JEKYLL_ENV=production bundle exec jekyll build</code><br>
|
|
</div>
|
|
Your Jekyll-project was now build and stored at _site.<br>
|
|
Now move the content of the localDev/_site to docs:<br>
|
|
<div>
|
|
<code>$ mv /localDev/_site docs</code><br>
|
|
</div>
|
|
And push your changes to your central GitHub-Repository.<br>
|
|
</p>
|
|
<p>
|
|
Now <a href="https://github.com/WickedJack99/website/settings/pages" target="_blank">publish your repository on GitHub Pages</a>.<br>
|
|
Select your <i>branch</i> and as <i>folder /docs</i> and hit Save.<br>
|
|
Now you have to wait, this can take up to 10 minutes.<br>
|
|
On the top of the page a box will appear with the url of your website.<br>
|
|
</p>
|
|
<h3>Happy developing!</h3>
|
|
<p id="sources">
|
|
Sources:<br>
|
|
<ul>
|
|
<li><a href="https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/creating-a-github-pages-site-with-jekyll" target="_blank">https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/creating-a-github-pages-site-with-jekyll</a></li>
|
|
<li><a href="https://docs.github.com/en/pages/quickstart" target="_blank">https://docs.github.com/en/pages/quickstart</a></li>
|
|
<li><a href="https://docs.github.com/en/get-started/quickstart/set-up-git" target="_blank">https://docs.github.com/en/get-started/quickstart/set-up-git</a></li>
|
|
<li><a href="https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/testing-your-github-pages-site-locally-with-jekyll" target="_blank">https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/testing-your-github-pages-site-locally-with-jekyll</a></li>
|
|
<li><a href="" target="_blank"></a></li>
|
|
<li><a href="" target="_blank"></a></li>
|
|
<li><a href="" target="_blank"></a></li>
|
|
<li><a href="https://jekyllrb.com/docs/structure/" target="_blank">https://jekyllrb.com/docs/structure/</a></li>
|
|
<li><a href="https://jekyllrb.com/docs/step-by-step/01-setup/" target="_blank">https://jekyllrb.com/docs/step-by-step/01-setup/</a></li>
|
|
<li><a href="https://jekyllrb.com/docs/step-by-step/10-deployment/" target="_blank">https://jekyllrb.com/docs/step-by-step/10-deployment/</a></li>
|
|
</ul>
|
|
</p>
|
|
</section>
|
|
<nav>
|
|
|
|
<a href="/website/terms.html" >Terms</a>
|
|
|
|
<a href="/website/privacy.html" >Privacy</a>
|
|
|
|
<a href="/website/blog.html" >Blog</a>
|
|
|
|
<a href="/website/imprint.html" >Imprint</a>
|
|
|
|
</nav>
|
|
</body>
|
|
</html> |