Hugo go go go

Made a hugo setup from scratch to generate a static blog and portfolio webpage.
The old stuff may still be found in static/old.
This commit is contained in:
Sivert V. Sæther 2022-03-29 22:52:36 +00:00
parent 1e418219e9
commit d64efb5fb4
60 changed files with 658 additions and 33 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.hugo_build.lock

1
CNAME Normal file
View File

@ -0,0 +1 @@
io.sivert.pw

15
Makefile Normal file
View File

@ -0,0 +1,15 @@
HUGO := hugo
.PHONY: publish build create
publish: build
git add public/
git commit -m'public/ autocommit'
git push
build:
rm -fr public/
$(HUGO) --gc --minify
create:
$(HUGO) server --bind 0.0.0.0

View File

@ -1,3 +1,6 @@
# My github.io # My github.io
I dunno what to host here, prolly will add someting cool later some time. I've converted this page to a hugo generated static webpage.
Will hopefully use it as a portfolio and blog.
How exciting?

14
archetypes/blog.md Normal file
View File

@ -0,0 +1,14 @@
---
deprecated: false
publishdate: {{ dateFormat "Jan 2 15:04 2006" now }}
lastmod: {{ dateFormat "Jan 2 15:04 2006" now }}
date: {{ dateFormat "Jan 2 15:04 2006" now }}
aliases: []
categories: ["various"]
series: []
tags: ["various"]
draft: true
toc: true
title: {{ replace .Name "-" " " | title }}
description:
---

14
archetypes/default.md Normal file
View File

@ -0,0 +1,14 @@
---
deprecated: false
publishdate: {{ dateFormat "Jan 2 15:04 2006" now }}
lastmod: {{ dateFormat "Jan 2 15:04 2006" now }}
date: {{ dateFormat "Jan 2 15:04 2006" now }}
aliases: []
categories: ["meta"]
series: []
tags: ["info","meta"]
draft: true
toc: true
title: {{ replace .Name "-" " " | title }}
description:
---

View File

@ -0,0 +1,10 @@
defaultContentLanguage: en
enableRobotsTXT: true
author:
name: Sivert V. Sæther
email: gmail@sivert.pw
copyright: GPL-3
taxonomies:
category: categories
series: series
tag: tags

View File

@ -0,0 +1,12 @@
en:
title: Sivert Does Stuff Online!
languageName: English
weight: 0
'no':
title: Sivert Gjør Ting På Nett!
languageName: Norsk
weight: 2
nl:
title: Sivert Doen Dingen Online!
languageName: Nederlands
weight: 3

View File

@ -0,0 +1,13 @@
main:
- name: Blog
url: /blog
weight: 10
- name: About
url: /about
weight: 3
# - name: Old GitHub.io
# url: /old
# weight: 2
- name: My Humble Homepage
url: https://sivert.pw
weight: 1

View File

@ -0,0 +1,13 @@
main:
- name: Blogg
url: /no/blog
weight: 10
- name: Om websiden
url: /no/about
weight: 3
- name: IT1 vgs
url: /old/it1
weight: 2
- name: Hjemmeside
url: https://sivert.pw
weight: 1

16
content/_index.en.md Normal file
View File

@ -0,0 +1,16 @@
---
deprecated: false
publishdate: Mar 27 18:08 2022
lastmod: Mar 27 18:08 2022
date: Mar 27 18:08 2022
draft: false
aliases: []
categories: ["Meta"]
series: []
tags: ["Info","Meta"]
toc: false
title: Welcome!
description: Landing page for Siverts GitHub Pages blog and portfolio.
---
So I guess I've finally got to updating my github.io site. Nice!

17
content/_index.nl.md Normal file
View File

@ -0,0 +1,17 @@
---
deprecated: false
publishdate: Mar 27 18:08 2022
lastmod: Mar 27 18:08 2022
date: Mar 27 18:08 2022
draft: true
aliases: []
categories: ["Meta"]
series: []
tags: ["Info","Meta"]
toc: false
title:
description:
---
# Velkommen!
Så jeg har visst endelig kommet runt til å oppdatere min github.io side. Kult!

16
content/_index.no.md Normal file
View File

@ -0,0 +1,16 @@
---
deprecated: false
publishdate: Mar 27 18:08 2022
lastmod: Mar 29 27 18:08 2022
date: Mar 27 18:08 2022
draft: false
aliases: []
categories: ["Meta"]
series: []
tags: ["Info","Meta"]
toc: false
title: Velkommen!
description: Landings side for Siverts GitHub Pages blog og portefølje.
---
Så jeg har visst endelig kommet runt til å oppdatere min github.io side. Kult!

18
content/about.en.md Normal file
View File

@ -0,0 +1,18 @@
---
deprecated: false
publishdate: Mar 27 18:08 2022
lastmod: Mar 27 18:08 2022
date: Mar 27 18:08 2022
draft: false
aliases: []
categories: ["Meta"]
series: []
tags: ["Info","Meta"]
toc: false
title: About
description: About page for the website!
---
This webpage is my portfolio webpage and blog.
It's build with hugo and hosted on github.io with GitHub Pages!

18
content/about.no.md Normal file
View File

@ -0,0 +1,18 @@
---
deprecated: false
publishdate: Mar 29 21:10 2022
lastmod: Mar 29 21:10 2022
date: Mar 29 21:10 2022
draft: false
aliases: []
categories: ["Meta"]
series: []
tags: ["Info","Meta"]
toc: false
title: Om websiden
description: Denne delen av websiden forteller om hva du finner på den.
---
Denne websiden er mitt portefølje og blog.
Den er laget med hugo og servert på github.io med GitHub Pages!

18
content/blog/_index.en.md Normal file
View File

@ -0,0 +1,18 @@
---
deprecated: false
publishdate: Mar 27 18:04 2022
lastmod: Mar 27 18:04 2022
date: Mar 27 18:04 2022
draft: false
aliases: []
categories: ["Meta"]
series: []
tags: ["Info","Meta"]
toc: false
title: Siverts Tech Adventure Blog
description: Landing page for Sivers Tech Adventure Blog!
---
Here you are welcome to take a look at all my blog posts!
And be sure to add the RSS feed to your news reader! ;)

16
content/blog/_index.no.md Normal file
View File

@ -0,0 +1,16 @@
---
deprecated: false
publishdate: Mar 29 21:00 2022
lastmod: Mar 29 21:00 2022
date: Mar 29 21:00 2022
draft: false
aliases: []
categories: ["Meta"]
series: []
tags: ["Info","Meta"]
toc: false
title: Siverts Teknologi Evenetyr Blog
description: Landingsside for Siverts Teknologi Evenetyr Blog!
---
Her er du velkommen til å ta en titt på alle mine blog innlegg!

13
i18n/en.toml Normal file
View File

@ -0,0 +1,13 @@
[translations]
other = 'Translations'
[languages]
other = 'Languages'
[readMore]
other = 'Read More'
[wordCount]
other = 'This article has {{ .WordCount }} words.'
[readingTime]
one = 'One minute to read.'
other = '{{ .Count }} minutes to read.'

4
i18n/nl.toml Normal file
View File

@ -0,0 +1,4 @@
[translations]
other = 'Vertalingen'
[languages]
other = 'Talen'

13
i18n/no.toml Normal file
View File

@ -0,0 +1,13 @@
[translations]
other = 'Oversettelser'
[languages]
other = 'Språk'
[readMore]
other = 'Les Mer'
[wordCount]
other = 'Denne artikelen har {{ .WordCount }} ord.'
[readingTime]
other = '{{ .Count }} minutters lesetid.'
one = 'Ett minutts lesetid.'

View File

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name=”robots” content="index,follow">
{{ block "meta" . }}
<meta name="viewport" content="width=device-width,initial-scale=1.0">
{{ end }}
<meta name="twitter:card" content="summary">
<meta property="og:title" content="{{ site.Title }}" />
<meta property="og:url" content="{{ site.BaseURL }}" />
<meta property="og:site_name" content="{{ site.Title }}" />
<!-- <meta property="og:image" content=""> -->
{{ range .AlternativeOutputFormats -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
<link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.5.1/css/bootstrap.min.css' crossorigin='anonymous'>
{{ if isset .Params "title" }}
<title>{{ site.Title }} - {{ .Title }}</title>
{{ else }}
<title>{{ site.Title }}</title>
{{ end }}{{ if .Description }}
<meta name='description' content='{{ .Description }}'>
{{ end }}
{{ block "head" . }}
<link href='/main.css' rel='stylesheet'>
{{ end }}
</head>
<body>
<header>
{{ partial "nav.html" . }}
</header>
<div id="content">
<main>{{ block "main" . }}{{ end }}</main>
</div>
<!-- {{ partial "i18n/list.html" . }} -->
<footer>
{{ partial "footer.html" . }}
</footer>
</body>
{{ block "bottom" . }}{{ end }}
</html>

View File

@ -0,0 +1,10 @@
{{ define "main" }}
{{ .Content }}
<ul class='contents'>
{{ range .Pages }}
<li>
<a href='{{ .Permalink }}'>{{ .Date.Format "2006/01/02" }} - {{ .Title }}</a>
</li>
{{ end }}
</ul>
{{ end }}

View File

@ -0,0 +1,24 @@
{{ define "main" }}
<div class='row'>
<div class='col-md-2'>
<aside id="meta">
{{ .TableOfContents }}
</aside>
</div>
<div class='col-md-10'>
<article>
<header>
<h1>{{ .Title }}</h1>
</header>
{{ .Content }}
<ul class="contents">
{{ range .Pages }}
<li>
{{ partial "summary.html" . }}
</li>
{{ end }}
</ul>
</article>
</div>
</div>
{{ end }}

38
layouts/_default/rss.xml Normal file
View File

@ -0,0 +1,38 @@
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{- with .OutputFormats.Get "RSS" -}}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end -}}
{{ range $pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid>
<description>{{ .Summary | html }}</description>
</item>{{ end }}
</channel>
</rss>

View File

@ -0,0 +1,15 @@
{{ define "main" }}
<div class='row'>
<div class='col-md-2'>
{{ partial "toc.html" . }}
</div>
<div class='col-md-10'>
<article>
<header>
<h1>{{ .Title }}</h1>
</header>
{{ .Content }}
</article>
</div>
</div>
{{ end }}

21
layouts/blog/single.html Normal file
View File

@ -0,0 +1,21 @@
{{ define "main" }}
<div class='row'>
<div class='col-md-2'>
<aside id="meta">
{{ if .IsPage }}
{{ partial "breadcrumb.html" . }}
<p>{{ i18n "readingTime" .ReadingTime }}</p>
{{ end }}
{{ .TableOfContents }}
</aside>
</div>
<div class='col-md-10'>
<article>
<header>
<h1>{{ .Title }}</h1>
</header>
{{ .Content }}
</article>
</div>
</div>
{{ end }}

17
layouts/index.html Normal file
View File

@ -0,0 +1,17 @@
{{ define "main" }}
<div class='row'>
<div class='col-md-2'>
<aside id="meta">
{{ .TableOfContents }}
</aside>
</div>
<div class='col-md-10'>
<article>
<header>
<h1>{{ .Title }}</h1>
</header>
{{ .Content }}
</article>
</div>
</div>
{{ end }}

View File

@ -0,0 +1,13 @@
<ol class="nav navbar-nav">
{{ template "breadcrumbnav" (dict "p1" . "p2" .) }}
</ol>
{{ define "breadcrumbnav" }}
{{ if .p1.Parent }}
{{ template "breadcrumbnav" (dict "p1" .p1.Parent "p2" .p2 ) }}
{{ else if not .p1.IsHome }}
{{ template "breadcrumbnav" (dict "p1" .p1.Site.Home "p2" .p2 ) }}
{{ end }}
<li{{ if eq .p1 .p2 }} class="active"{{ end }}>
<a href="{{ .p1.Permalink }}">{{ .p1.Title }}</a>
</li>
{{ end }}

View File

@ -0,0 +1,13 @@
<center>
<div class='footer-content'>
<p>{{ now.Format "2006" }} &copy; Sivert V. Sæther</p>
</div>
<div class='footer-social'>
<!--
<a href="#" class="icons"><img src="/facebook-icon.svg"></a>
<a href="#" class="icons"><img src="/linkedin-icon.svg"></a>
<a href="#" class="icons"><img src="/twitter-icon.svg"></a>
<a href="#" class="icons"><img src="/youtube-icon.svg"></a>
-->
</div>
</center>

View File

@ -0,0 +1,6 @@
{{ if .IsTranslated }}<h4>{{ T "translations" }}</h4>
<ul>{{ range .Translations }}
<li>
<a href='{{ .Permalink }}'>{{ .Lang }}: {{ .Title }}{{ if .IsPage }} ({{ i18n "wordCount" . }}){{ end }}</a>
</li>{{ end }}
</ul>{{ end }}

View File

@ -0,0 +1,8 @@
<li id='lang-menu'>
<a id='lang-menu-btn' href='#'>{{ T "translations" }}</a>
<ul>
{{ range $.Site.Home.AllTranslations }}
<li><a href='{{ .Permalink }}'>{{ .Language.LanguageName }}</a></li>
{{ end }}
</ul>
</li>

34
layouts/partials/nav.html Normal file
View File

@ -0,0 +1,34 @@
<nav id="navbar">
<ul class="top-nav">
<li class=""><a href="/">{{ site.Title }}</a></li>
{{ partial "i18n/nav.html" . }}
<div class="link-group">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
<li class='{{ if $currentPage.HasMenuCurrent "main" . }}active{{ end }}'>
<a href='#'>{{ .Pre }}<span>{{ .Name }}</span></a>
</li>
<ul class='sub-menu'>
{{ range .Children }}
<li class='{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}'>
<a href='{{ .URL }}'>{{ .Name }}</a>
</li>
{{ end }}
</ul>
{{ else }}
<li>
<a href='{{ .URL }}'>
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
{{ end }}
{{ end }}
<!-- <li class="top-nav__link"><a href="#">
<img class="icons" src="/search-icon.svg">
</a>
</li> -->
</div>
</ul>
</nav>

View File

@ -0,0 +1,11 @@
<article>
<div>
<h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
{{ .Summary }}
</div>
{{ if .Truncated }}
<div>
<a href="{{ .RelPermalink }}">{{ i18n "readMore" }}…</a>
</div>
{{ end }}
</article>

View File

@ -0,0 +1,6 @@
<aside id='meta'>
<header>
<h4>{{ .Title }}</h4>
</header>
{{ .TableOfContents }}
</aside>

2
layouts/robots.txt Normal file
View File

@ -0,0 +1,2 @@
User-agent: *{{ range .Site.AllPages }}
Allow: {{ .RelPermalink }}{{ end }}

34
static/chroma.css Normal file
View File

@ -0,0 +1,34 @@
.chroma { background-color: #ffffff }
.chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
.chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block; }
.chroma .hl { display: block; width: 100%;background-color: #ffffcc }
.chroma .lnt { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
.chroma .ln { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
.chroma .k { color: #0000ff }
.chroma .kc { color: #0000ff }
.chroma .kd { color: #0000ff }
.chroma .kn { color: #0000ff }
.chroma .kp { color: #0000ff }
.chroma .kr { color: #0000ff }
.chroma .kt { color: #0000ff }
.chroma .s { color: #009c00 }
.chroma .sa { color: #009c00 }
.chroma .sb { color: #009c00 }
.chroma .sc { color: #009c00 }
.chroma .dl { color: #009c00 }
.chroma .sd { color: #009c00 }
.chroma .s2 { color: #009c00 }
.chroma .se { color: #009c00 }
.chroma .sh { color: #009c00 }
.chroma .si { color: #009c00 }
.chroma .sx { color: #009c00 }
.chroma .sr { color: #009c00 }
.chroma .s1 { color: #009c00 }
.chroma .ss { color: #009c00 }
.chroma .c { color: #ff0000; font-style: italic }
.chroma .ch { color: #ff0000; font-style: italic }
.chroma .cm { color: #ff0000; font-style: italic }
.chroma .c1 { color: #ff0000; font-style: italic }
.chroma .cs { color: #ff0000; font-style: italic }
.chroma .cp { color: #ff0000; font-style: italic }
.chroma .cpf { color: #ff0000; font-style: italic }

51
static/main.css Normal file
View File

@ -0,0 +1,51 @@
body {
background-color: rgb(18, 20, 21);
color: lime;
}
#content main {
background-color: rgb(24, 26, 27);
margin: 3% 10%;
padding: 3%;
}
#navbar {
background-color: #222;
}
#navbar li a:hover {
background-color: #333;
}
#navbar .link-group li {
float: right;
}
#navbar li {
display: inline;
float: left;
}
#navbar ul {
list-style-type: none;
overflow: hidden;
padding: 0;
margin: 0;
}
#navbar a {
text-decoration: none;
text-align: center;
padding: 14px 16px;
display: block;
color: lime;
}
#lang-menu ul {
background-color: #222;
position: absolute;
min-width: 160px;
display: none;
z-index: 1;
}
#lang-menu a {
display: block;
}
#lang-menu:hover ul {
display: block;
}

3
static/old/README.md Normal file
View File

@ -0,0 +1,3 @@
# My github.io
I dunno what to host here, prolly will add someting cool later some time.

View File

@ -4,12 +4,12 @@
<title>My humble github.io page</title> <title>My humble github.io page</title>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="/main.css"> <link rel="stylesheet" href="main.css">
</head> </head>
<body> <body>
<div id="content"> <div id="content">
<h3>Noting to see here</h3> <h3>Noting to see here</h3>
<p>You can check out work I did in IT1 (informasjons teknologi 1) a Norwegian optional vacational course <a href="/it1/">here</a>.</p> <p>You can check out work I did in IT1 (informasjons teknologi 1) a Norwegian optional vacational course <a href="it1/">here</a>.</p>
<p>Or even my very own webpage with some cool stuffs coming soon <a href="http://sivert.pw/">here</a>.</p> <p>Or even my very own webpage with some cool stuffs coming soon <a href="http://sivert.pw/">here</a>.</p>
</div> </div>
</body> </body>

View File

@ -4,17 +4,17 @@
<title>Firebase basert bibliotek</title> <title>Firebase basert bibliotek</title>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="/it1/main.css"> <link rel="stylesheet" href="../main.css">
<link rel="stylesheet" href="/it1/css/form.css"> <link rel="stylesheet" href="../css/form.css">
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-app.js"></script> <script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-auth.js"></script> <script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-firestore.js"></script> <script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-firestore.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script> <script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="/it1/js/init-firebase.js"></script> <script type="text/javascript" src="../js/init-firebase.js"></script>
<script type="text/javascript" src="/it1/js/converters/bok.js"></script> <script type="text/javascript" src="../js/converters/bok.js"></script>
</head> </head>
<body> <body>
<script type="text/javascript" id="navbar" src="/it1/js/navbar.js"></script> <script type="text/javascript" id="navbar" src="../js/navbar.js"></script>
<div id="content"> <div id="content">
<form action="#" method="POST" id="form" class="top"> <form action="#" method="POST" id="form" class="top">
<div class="form-group"> <div class="form-group">
@ -43,6 +43,6 @@
<div id="books"> <div id="books">
</div> </div>
</div> </div>
<script type="text/javascript" src="/it1/bibliotek/bibliotek.js"></script> <script type="text/javascript" src="bibliotek.js"></script>
</body> </body>
</html> </html>

View File

@ -4,16 +4,16 @@
<title>Firebase basert bibliotek</title> <title>Firebase basert bibliotek</title>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="/it1/main.css"> <link rel="stylesheet" href="../main.css">
<link rel="stylesheet" href="/it1/css/form.css"> <link rel="stylesheet" href="../css/form.css">
<script src="https://www.gstatic.com/firebasejs/7.11.0/firebase-app.js"></script> <script src="https://www.gstatic.com/firebasejs/7.11.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-auth.js"></script> <script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-auth.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script> <script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="/it1/js/init-firebase.js"></script> <script type="text/javascript" src="../js/init-firebase.js"></script>
<script type="text/javascript" src="/it1/js/auth.js"></script> <script type="text/javascript" src="../js/auth.js"></script>
</head> </head>
<body> <body>
<script type="text/javascript" id="navbar" src="/it1/js/navbar.js"></script> <script type="text/javascript" id="navbar" src="../js/navbar.js"></script>
<div id="content"> <div id="content">
<form action="#" method="POST" id="form" class="top"> <form action="#" method="POST" id="form" class="top">
<div class="form-group"> <div class="form-group">
@ -25,6 +25,6 @@
<div id="status"> <div id="status">
</div> </div>
</div> </div>
<script type="text/javascript" src="/it1/js/auth.js"></script> <script type="text/javascript" src="../js/auth.js"></script>
</body> </body>
</html> </html>

View File

@ -1,6 +1,39 @@
var db = firebase.firestore() var db = firebase.firestore()
class Comment {
constructor(name, message, id=0) {
this.name = name,
this.message = message,
this.cfid = id
}
toString() {
return this.name+': '+this.message
}
toHtml(elm) {
elm.append('<p class="kommentar"></p>')
$($('.kommentar')[$('.kommentar').length-1]).text(this.toString())
firebase.auth().currentUser?$($('.kommentar')[$('.kommentar').length-1]).append(' &nbsp; <a class="btn btn-primary" href="javascript: remove(\''+this.cfid+'\')">Slett</a>'):undefined
}
}
commentConverter = {
toFirestore: function(comment) {
return {
navn: comment.name,
melding: comment.message
}
},
fromFirestore: function(snapshot, options) {
const data = snapshot.data(options)
return new Comment(
data.navn,
data.melding,
snapshot.id
)
}
}
var list = function() { var list = function() {
db.collection('gjestebok') db.collection('gjestebok')
.withConverter(commentConverter) .withConverter(commentConverter)

View File

@ -4,18 +4,17 @@
<title>Firebase basert gjestebok</title> <title>Firebase basert gjestebok</title>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="/it1/main.css"> <link rel="stylesheet" href="../main.css">
<link rel="stylesheet" href="/it1/css/form.css"> <link rel="stylesheet" href="../css/form.css">
<link rel="stylesheet" href="/it1/css/gjestebok.css"> <link rel="stylesheet" href="../css/gjestebok.css">
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-app.js"></script> <script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-auth.js"></script> <script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-firestore.js"></script> <script src="https://www.gstatic.com/firebasejs/7.12.0/firebase-firestore.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script> <script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="/it1/js/init-firebase.js"></script> <script type="text/javascript" src="../js/init-firebase.js"></script>
<script type="text/javascript" src="/it1/js/converters/kommentar.js"></script>
</head> </head>
<body> <body>
<script type="text/javascript" id="navbar" src="/it1/js/navbar.js"></script> <script type="text/javascript" id="navbar" src="../js/navbar.js"></script>
<div id="content"> <div id="content">
<form action="#" method="POST" id="form" class="top"> <form action="#" method="POST" id="form" class="top">
<div class="form-group"> <div class="form-group">
@ -34,6 +33,6 @@
</div> </div>
<p id="status"></p> <p id="status"></p>
</div> </div>
<script type="text/javascript" src="/it1/gjestebok/gjestebok.js"></script> <script type="text/javascript" src="gjestebok.js"></script>
</body> </body>
</html> </html>

View File

@ -4,25 +4,25 @@
<title>Simple firebase stuff</title> <title>Simple firebase stuff</title>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="/it1/main.css"> <link rel="stylesheet" href="main.css">
<script src="https://www.gstatic.com/firebasejs/7.11.0/firebase-app.js"></script> <script src="https://www.gstatic.com/firebasejs/7.11.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.11.0/firebase-auth.js"></script> <script src="https://www.gstatic.com/firebasejs/7.11.0/firebase-auth.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script> <script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="/it1/js/init-firebase.js"></script> <script type="text/javascript" src="js/init-firebase.js"></script>
<script type="text/javascript" src="/it1/js/auth.js"></script> <script type="text/javascript" src="js/auth.js"></script>
</head> </head>
<body> <body>
<!-- <iframe id="navbar" width="100%" height="60px" src="/it1/navbar/navbar.html" style="border: 0px"></iframe> --> <!-- <iframe id="navbar" width="100%" height="60px" src="/it1/navbar/navbar.html" style="border: 0px"></iframe> -->
<script type="text/javascript" id="navbar" src="/it1/js/navbar.js"></script> <script type="text/javascript" id="navbar" src="js/navbar.js"></script>
<div id="content"> <div id="content">
<h3 style="margin: 3vh">Denne siden inneholder ting jeg har laget med firebase i IT1!</h3> <h3 style="margin: 3vh">Denne siden inneholder ting jeg har laget med firebase i IT1!</h3>
<br /> <br />
<ul id="oppgaver"> <ul id="oppgaver">
<li> <li>
<h5><a href="/it1/gjestebok/">Gjestebok</a></h5> <h5><a href="gjestebok/">Gjestebok</a></h5>
</li> </li>
<li> <li>
<h5><a href="/it1/bibliotek/">Bibliotek</a></h5> <h5><a href="bibliotek/">Bibliotek</a></h5>
</li> </li>
</ul> </ul>
<br /> <br />

View File

@ -3,15 +3,15 @@
<head> <head>
<title>Navbar for iframe</title> <title>Navbar for iframe</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="/it1/navbar/navbar.css"> <link rel="stylesheet" href="../navbar/navbar.css">
<!-- <script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script> --> <!-- <script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script> -->
</head> </head>
<body> <body>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark"> <nav class="navbar navbar-expand-sm bg-dark navbar-dark">
<a class="navbar-brand" target="_top" href="/it1/index.html">IT1 firebase stuff</a> <!-- href="/it1/index.html" --> <a class="navbar-brand" target="_top" href="/old/it1/index.html">IT1 firebase stuff</a> <!-- href="../index.html" -->
<!-- <ul class="navbar-nav"> <!-- <ul class="navbar-nav">
<li class="nav-item right"> <li class="nav-item right">
<a class="nav-link" target="_top" href="/it1/about.html">About</a> <a class="nav-link" target="_top" href="../about.html">About</a>
</li> </li>
</ul> </ul>
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">

View File

@ -4,8 +4,8 @@
<title>Problemer med smittestopp</title> <title>Problemer med smittestopp</title>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="/it1/smittestopp/corona.css"> <link rel="stylesheet" href="../smittestopp/corona.css">
<link rel="stylesheet" href="/it1/main.css"> <link rel="stylesheet" href="../main.css">
</head> </head>
<body> <body>
<div id="content" style="margin-right: 13vw"> <div id="content" style="margin-right: 13vw">