Skip to content
Snippets Groups Projects
Commit b1480c61 authored by Fabian Kongelf's avatar Fabian Kongelf
Browse files

Merge branch 'master' of git.gvk.idi.ntnu.no:Fabian/dcsg2900-gitlab-pages into master

parents 0f05c320 08f65f32
No related branches found
No related tags found
No related merge requests found
![Build Status](https://gitlab.com/pages/jekyll/badges/master/build.svg)
![Jekyll Version](https://img.shields.io/gem/v/jekyll.svg)
---
Example [Jekyll] website using GitLab Pages. View it live at https://pages.gitlab.io/jekyll
[Learn more about GitLab Pages](https://pages.gitlab.io) or read the the [official GitLab Pages documentation](https://docs.gitlab.com/ce/user/project/pages/).
---
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
- [Getting Started](#getting-started)
- [Start by forking this repository](#start-by-forking-this-repository)
- [Start from a local Jekyll project](#start-from-a-local-jekyll-project)
- [GitLab CI](#gitlab-ci)
- [Using Jekyll locally](#using-jekyll-locally)
- [GitLab User or Group Pages](#gitlab-user-or-group-pages)
- [Did you fork this project?](#did-you-fork-this-project)
- [Other examples](#other-examples)
- [Troubleshooting](#troubleshooting)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Getting Started
You can get started with GitLab Pages using Jekyll easily by either forking this repository or by uploading a new/existing Jekyll project.
Remember you need to wait for your site to build before you will be able to see your changes. You can track the build on the **Pipelines** tab.
### Start by forking this repository
1. Fork this repository.
1. **IMPORTANT:** Remove the fork relationship.
Go to **Settings (⚙)** > **Edit Project** and click the **"Remove fork relationship"** button.
1. Enable Shared Runners.
Go to **Settings (⚙)** > **Pipelines** and click the **"Enable shared Runners"** button.
1. Rename the repository to match the name you want for your site.
1. Edit your website through GitLab or clone the repository and push your changes.
### Start from a local Jekyll project
1. [Install][] Jekyll.
1. Use `jekyll new` to create a new Jekyll Project.
1. Add [this `.gitlab-ci.yml`](.gitlab-ci.yml) to the root of your project.
1. Push your repository and changes to GitLab.
## GitLab CI
This project's static Pages are built by [GitLab CI][ci], following the steps
defined in [`.gitlab-ci.yml`](.gitlab-ci.yml):
```
image: ruby:2.3
variables:
JEKYLL_ENV: production
pages:
script:
- bundle install
- bundle exec jekyll build -d public
artifacts:
paths:
- public
only:
- master
```
## Using Jekyll locally
To work locally with this project, you'll have to follow the steps below:
1. Fork, clone or download this project
1. [Install][] Jekyll
1. Download dependencies: `bundle`
1. Build and preview: `bundle exec jekyll serve`
1. Add content
The above commands should be executed from the root directory of this project.
Read more at Jekyll's [documentation][].
## GitLab User or Group Pages
To use this project as your user/group website, you will need one additional
step: just rename your project to `namespace.gitlab.io`, where `namespace` is
your `username` or `groupname`. This can be done by navigating to your
project's **Settings**.
Read more about [user/group Pages][userpages] and [project Pages][projpages].
## Did you fork this project?
If you forked this project for your own use, please go to your project's
**Settings** and remove the forking relationship, which won't be necessary
unless you want to contribute back to the upstream project.
## Other examples
* [jekyll-branched](https://gitlab.com/pages/jekyll-branched) demonstrates how you can keep your GitLab Pages site in one branch and your project's source code in another.
* The [jekyll-themes](https://gitlab.com/groups/jekyll-themes) group contains a collection of example projects you can fork (like this one) having different visual styles.
## Troubleshooting
1. CSS is missing! That means two things:
* Either that you have wrongly set up the CSS URL in your templates, or
* your static generator has a configuration option that needs to be explicitly
set in order to serve static assets under a relative URL.
[ci]: https://about.gitlab.com/gitlab-ci/
[Jekyll]: http://jekyllrb.com/
[install]: https://jekyllrb.com/docs/installation/
[documentation]: https://jekyllrb.com/docs/home/
[userpages]: https://docs.gitlab.com/ce/user/project/pages/introduction.html#user-or-group-pages
[projpages]: https://docs.gitlab.com/ce/user/project/pages/introduction.html#project-pages
<header class="site-header">
<div class="wrapper">
<a class="site-title" href="{{ site.baseurl }}/">{{ site.title }}</a>
<nav class="site-nav">
<a href="#" class="menu-icon">
<svg viewBox="0 0 18 15">
<path fill="#424242" d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.031C17.335,0,18,0.665,18,1.484L18,1.484z"/>
<path fill="#424242" d="M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0c0-0.82,0.665-1.484,1.484-1.484 h15.031C17.335,6.031,18,6.696,18,7.516L18,7.516z"/>
<path fill="#424242" d="M18,13.516C18,14.335,17.335,15,16.516,15H1.484C0.665,15,0,14.335,0,13.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.031C17.335,12.031,18,12.696,18,13.516L18,13.516z"/>
</svg>
</a>
<div class="trigger">
{% for my_page in site.pages %}
{% if my_page.title %}
<a class="page-link" href="{{ my_page.url | prepend: site.baseurl }}">{{ my_page.title }}</a>
{% endif %}
{% endfor %}
</div>
</nav>
</div>
</header>
<header class="site-header">
<div class="navbar" id="navbar">
<article>
<div class="hamburger" onclick="hamburger_open(this)">
<div class="bar1"></div>
<div class="bar2"></div>
<div class="bar3"></div>
</div>
</article>
<article class="breadcrumb">
<p><a href="{{ site.baseurl }}/">{{ site.title }}</a></p>
</article>
<article class="links">
<!-- insert links to folder content -->
<ul>
{% assign sorted_pages = site.posts | sort:"order" %} <!-- Retrieve array of all posts and sort them by "order" variable -->
{% for counter in (0..{{sorted_pages.size}}) %} <!-- for 0 .. end of array -->
{% if page.order == sorted_pages[counter].order %} <!-- if index is current post -->
{% assign priveous = counter | minus: 1 %} <!-- priveous post in index -1 -->
{% assign next = counter | plus: 1 %} <!-- next post is index + 1 -->
{% if next == sorted_pages.size %} <!-- unless if you have reached end of array -->
{% assign next = 0 %} <!-- next post should be pointing to the first index -->
{% endif %}
{% endif %}
{% endfor %}
{% if sorted_pages[next] == null %} <!-- in the case next is out of bounds -->
{% assign next = 0 %} <!-- point to first post -->
{% endif %}
{% if sorted_pages[priveous] == null %} <!-- in the case priveous is out of bounds -->
{% assign priveous = {{sorted_pages.size}} %} <!-- point to last post -->
{% endif %}
<!-- Link to priveous post -->
<li>
<a href="{{sorted_pages[priveous].url | prepend: site.baseurl}}">{{sorted_pages[priveous].slug}}</a>
</li>
<!-- Link to next post -->
<li>
<a href="{{sorted_pages[next].url | prepend: site.baseurl}}">{{sorted_pages[next].slug}}</a>
</li>
</ul>
</article>
<article class="ntnu-logo">
<a href="{{ site.baseurl }}/">
<div id="logo-blaa">{% include icon-ntnu-uslagord.html %}</div>
</a>
<a href="{{ site.baseurl }}/">
<div id="logo-svart-inv" style="display: none">{% include icon-ntnu-uslagord-svart.html %}</div>
</a>
</article>
</div>
<article id="hamburger-content" class="hamburger-content">
<div>
<h2 class="navbar-heading">All categories in site</h2> <!-- slett meg -->
</div>
<div>
{% for category in site.categories %}
<article>
{% if category[1].size == 1 %}
<ul>
<li class="cat-element">
<a class="post-link" href="{{ category[1][0].url | prepend: site.baseurl }}">{{ category | first }}</a>
</li>
{% else %}
<h3 id="{{ category[0] | slugify }}" class="cat-header">
<a class="post-link" href="#">{{ category | first }}</a>
</h3>
<ul>
{% for post in category[1] %}
<li class="cat-element">
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
</li>
{% endfor %}
{% endif %}
</ul></article>
{% endfor %}
</div>
<div>
<article>
<h2 class="navbar-heading">All files related to the current post</h2> <!-- Dynamisk henting av alle IKKE markdown filer i samme directory som page -->
{% assign filename = page.path | split: "/" | last %} <!-- hent denne post sitt navn, for eks compendia -->
{% assign path = page.path | remove: filename | remove: "_posts/" %} <!-- fjern filnavn og _posts fra filsti, for eks /emne/.. istedenfor _posts/emne/compendia -->
<ul>
{% if path !=""%} <!-- Sjekk om "path" er tom, dersom tom er post i toppen av _posts folderen -->
{% for file in site.static_files %} <!-- se gjennom alle filer som ikke markdowm -->
{% if file.path contains path %} <!-- Dersom filen er i samme folder som post -->
{% if file.extname == '.png' or file.extname == '.PNG' or file.extname == '.pdf' or file.extname == '.PDF' or file.extname == '.jpg' or file.extname == '.JPG' or file.extname == '.jpeg' or file.extname == '.JPEG' %} <!-- Hent ut de type filer du vil linke til -->
{% assign filePath = site.baseurl | append: file.path | remove: "_posts" %} <!-- lag fullverdig filsti -->
<li class="cat-element">
<a href="{{ file.basename}}{{file.extname}}">{{file.basename}} </a>
</li>
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
</ul>
</article>
</div>
</article>
</header>
<script>
var prevBackgroundColor;
var prevBorderColor;
function hamburger_open(x) {
x.classList.toggle("change");
y = document.getElementById("hamburger-content");
z = document.getElementById("navbar");
logoBlaa = document.getElementById("logo-blaa");
logoSvartInv = document.getElementById("logo-svart-inv");
if (x.classList.contains("change")) {
prevBackgroundColor = window.getComputedStyle(z, null).getPropertyValue('background-color');
prevBorderColor = window.getComputedStyle(z, null).getPropertyValue('border-color');
y.style.height = "100vh";
z.style.background = "rgba(28,28,28,1)";
z.style.border = "none";
logoBlaa.style.display = "none";
logoSvartInv.style.display = "block";
setTimeout(() => { y.style.overflow = "auto"; }, 250);
} else {
y.style.height = "0vh";
y.style.overflow = "hidden";
setTimeout(() => {
z.style.background = prevBackgroundColor;
z.style.borderBottom = "1px solid";
z.style.borderColor = prevBorderColor
logoBlaa.style.display = "block";
logoSvartInv.style.display = "none";
}, 400);
}
}
</script>
<header class="site-header">
<div class="navbar" id="navbar">
<article>
<div class="hamburger" onclick="hamburger_open(this)">
<div class="bar1"></div>
<div class="bar2"></div>
<div class="bar3"></div>
</div>
</article>
<article class="breadcrumb">
<p><a href="{{ site.baseurl }}/">{{ site.title }}</a></p>
</article>
<article class="links">
<!-- insert links to folder content -->
<ul>
{% assign sorted_pages = site.posts | sort:"order" %} <!-- Retrieve array of all posts and sort them by "order" variable -->
{% for counter in (0..{{sorted_pages.size}}) %} <!-- for 0 .. end of array -->
{% if page.order == sorted_pages[counter].order %} <!-- if index is current post -->
{% assign priveous = counter | minus: 1 %} <!-- priveous post in index -1 -->
{% assign next = counter | plus: 1 %} <!-- next post is index + 1 -->
{% if next == sorted_pages.size %} <!-- unless if you have reached end of array -->
{% assign next = 0 %} <!-- next post should be pointing to the first index -->
{% endif %}
{% endif %}
{% endfor %}
{% if sorted_pages[next] == null %} <!-- in the case next is out of bounds -->
{% assign next = 0 %} <!-- point to first post -->
{% endif %}
{% if sorted_pages[priveous] == null %} <!-- in the case priveous is out of bounds -->
{% assign priveous = {{sorted_pages.size}} %} <!-- point to last post -->
{% endif %}
<!-- Link to priveous post -->
<li>
<a href="{{sorted_pages[priveous].url | prepend: site.baseurl}}">{{sorted_pages[priveous].slug}}</a>
</li>
<!-- Link to next post -->
<li>
<a href="{{sorted_pages[next].url | prepend: site.baseurl}}">{{sorted_pages[next].slug}}</a>
</li>
</ul>
</article>
<article class="ntnu-logo">
<a href="{{ site.baseurl }}/">
<div id="logo-blaa">{% include icon-ntnu-uslagord.html %}</div>
</a>
<a href="{{ site.baseurl }}/">
<div id="logo-svart-inv" style="display: none">{% include icon-ntnu-uslagord-svart.html %}</div>
</a>
</article>
</div>
<article id="hamburger-content" class="hamburger-content">
<div>
<h2 class="navbar-heading">Content</h2>
{% include index-toc.html %}
</div>
<div>
<h2 class="navbar-heading">Other ressources in catagory</h2>
<article>
{% assign filename = page.path | split: "/" | last %} <!-- hent denne post sitt navn, for eks compendia -->
{% assign path = page.path | remove: filename | remove: "_posts/" %} <!-- fjern filnavn og _posts fra filsti, for eks /emne/.. istedenfor _posts/emne/compendia -->
<ul>
{% if path !=""%} <!-- Sjekk om "path" er tom, dersom tom er post i toppen av _posts folderen -->
{% for file in site.static_files %} <!-- se gjennom alle filer som ikke markdowm -->
{% if file.path contains path %} <!-- Dersom filen er i samme folder som post -->
{% if file.extname == '.png' or file.extname == '.PNG' or file.extname == '.pdf' or file.extname == '.PDF' or file.extname == '.jpg' or file.extname == '.JPG' or file.extname == '.jpeg' or file.extname == '.JPEG' %} <!-- Hent ut de type filer du vil linke til -->
{% assign filePath = site.baseurl | append: file.path | remove: "_posts" %} <!-- lag fullverdig filsti -->
<li class="cat-element">
<!-- link to file, opens in a new tab. -->
<a href="{{ file.basename}}{{file.extname}}" target="_blank" rel="noopener noreferrer">
{{file.basename}}{{file.extname}}
</a>
</li>
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
</ul>
</article>
</div>
</article>
</header>
<script>
var prevBackgroundColor;
var prevBorderColor;
function hamburger_open(x) {
x.classList.toggle("change");
y = document.getElementById("hamburger-content");
z = document.getElementById("navbar");
logoBlaa = document.getElementById("logo-blaa");
logoSvartInv = document.getElementById("logo-svart-inv");
if (x.classList.contains("change")) {
prevBackgroundColor = window.getComputedStyle(z, null).getPropertyValue('background-color');
prevBorderColor = window.getComputedStyle(z, null).getPropertyValue('border-color');
y.style.height = "100vh";
z.style.background = "rgba(28,28,28,1)";
z.style.border = "none";
logoBlaa.style.display = "none";
logoSvartInv.style.display = "block";
setTimeout(() => { y.style.overflow = "auto"; }, 250);
} else {
y.style.height = "0vh";
y.style.overflow = "hidden";
setTimeout(() => {
z.style.background = prevBackgroundColor;
z.style.borderBottom = "1px solid";
z.style.borderColor = prevBorderColor
logoBlaa.style.display = "block";
logoSvartInv.style.display = "none";
}, 400);
}
}
</script>
---
layout: default
---
<div class="home">
<h1>
{{ site.title }}
</h1>
<p>
{% include_relative about.md %}
</p>
<div>
<h1 class="page-heading">Content</h1>
<ul class="post-list">
{% for category in site.categories %}
{% if category[0] == "content" %}
{% for post in category[1] %}
{% if post.categories.size == 1 %}
<li class="cat-element">
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
</li>
{% endif %}
{% endfor %}
{% else %}
<li class="cat-element">
{% if category[1].size == 1 %}
<a class="post-link" href="{{ category[1][0].url | prepend: site.baseurl }}">{{ category | first }}</a>
{% else %}
<a class="post-link cat-header" href="#">{{ category | first }}</a>
<ul>
{% for post in category[1] %}
{% if post.categories.size > 2 %}
<!-- hvis den har subcategorier... -->
{% else %}
<li class="cat-element">
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
</li>
{% endif %}
{% if category.child %}
<p>child: true</p>
{% else %}
<p>not child</p>
{% endif %}
{% endfor %}
</ul>
</div>
<div> hei
{% assign structur = "" %}
{% for post in site.posts %}
<p>{{ post.title }}</p>
{{ post.categories.size }}
{% assign cat = "" %}
{{ post.url }}
{% for category in post.categories %}
{% if category == "content" %}
{% else %}
{% endif %}
{% endfor %}
{% endfor %}
</div>
</div>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment