Add breadcrumbs, let writeup urls make more sense and add section pages

This commit is contained in:
2021-11-30 17:38:58 +01:00
parent e92b7e02fe
commit d6544b95cf
46 changed files with 427 additions and 188 deletions
+4 -3
View File
@@ -36,7 +36,8 @@ disableHugoGeneratorInject = false
googleAnalytics = "UA-136337666-1"
[permalinks]
posts = "/posts/:year/:month/:title/"
posts = "/posts/:title/"
writeups = "/:sections/:title/"
[author]
name = "Maik de Kruif"
@@ -48,8 +49,8 @@ googleAnalytics = "UA-136337666-1"
twitter = "@maik_dev"
[outputs]
home = ["HTML", "AMP", "RSS"]
page = ["HTML", "AMP", "RSS"]
home = ["HTML", "RSS"]
page = ["HTML", "RSS"]
[params]
dateform = "Jan 2, 2006"
@@ -0,0 +1,5 @@
+++
author = "Maik de Kruif"
title = "2020"
description = "My Advent of CTF - 2020 writeups."
+++
@@ -18,6 +18,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_0"
]
+++
- Points: 1
@@ -18,6 +18,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_1"
]
+++
- Points: 100
@@ -18,6 +18,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_10"
]
+++
- Points: 1000
@@ -19,6 +19,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_11"
]
+++
- Points: 1100
@@ -19,6 +19,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_12"
]
+++
- Points: 1200
@@ -19,6 +19,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_13"
]
+++
- Points: 1300
@@ -19,6 +19,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_14"
]
+++
- Points: 1400
@@ -19,6 +19,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_15"
]
+++
- Points: 1500
@@ -20,6 +20,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_16"
]
+++
- Points: 1600
@@ -20,6 +20,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_17"
]
+++
- Points: 1700
@@ -20,6 +20,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_18"
]
+++
- Points: 1800
@@ -20,6 +20,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_19"
]
+++
- Points: 1900
@@ -19,6 +19,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_2"
]
+++
- Points: 200
@@ -20,6 +20,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_20"
]
+++
- Points: 2000
@@ -19,6 +19,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_21"
]
+++
- Points: 2100
@@ -20,6 +20,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_22"
]
+++
- Points: 2200
@@ -19,6 +19,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_23"
]
+++
- Points: 2300
@@ -21,6 +21,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_24"
]
+++
- Points: 2400
@@ -19,6 +19,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_3"
]
+++
- Points: 300
@@ -19,6 +19,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_4"
]
+++
- Points: 400
@@ -19,6 +19,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_5"
]
+++
- Points: 500
@@ -19,6 +19,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_6"
]
+++
- Points: 600
@@ -19,6 +19,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_7"
]
+++
- Points: 700
@@ -18,6 +18,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_8"
]
+++
- Points: 800
@@ -18,6 +18,9 @@ categories = [
"writeups",
"hacking",
]
aliases = [
"challenge_9"
]
+++
- Points: 900
@@ -15,6 +15,9 @@ categories = [
"ctf",
"hacking",
]
aliases = [
"intro"
]
+++
So, I'm in this Discord server and somebody by the name [@credmp](https://twitter.com/credmp) thought it'd be a great idea to do an advent calendar of CTF challenges. Every day of december, up until christmas, a new challenge will open up. It starts out easy, accessible to anyone and will grow in complexity as time progresses.
+5
View File
@@ -0,0 +1,5 @@
+++
author = "Maik de Kruif"
title = "Advent of CTF"
description = "My Advent of CTF writeups."
+++
@@ -0,0 +1,5 @@
+++
author = "Maik de Kruif"
title = "2021"
description = "My Google CTF - 2021 writeups."
+++
@@ -20,6 +20,9 @@ categories = [
"hacking",
"rev",
]
aliases = [
"1"
]
+++
## Story line
@@ -19,6 +19,9 @@ categories = [
"hacking",
"hardware",
]
aliases = [
"10"
]
+++
## Story line
@@ -20,6 +20,9 @@ categories = [
"hacking",
"misc",
]
aliases = [
"2"
]
+++
## Story line
@@ -21,6 +21,9 @@ categories = [
"hacking",
"misc",
]
aliases = [
"3"
]
+++
## Story line
@@ -20,6 +20,9 @@ categories = [
"writeups",
"hw",
]
aliases = [
"4"
]
+++
## Story line
@@ -19,6 +19,9 @@ categories = [
"hacking",
"misc",
]
aliases = [
"5"
]
+++
## Story line
@@ -19,6 +19,9 @@ categories = [
"hacking",
"misc",
]
aliases = [
"6"
]
+++
## Story line
@@ -19,6 +19,9 @@ categories = [
"hacking",
"crypto",
]
aliases = [
"7"
]
+++
## Story line
@@ -19,6 +19,9 @@ categories = [
"hacking",
"misc",
]
aliases = [
"8"
]
+++
## Story line
@@ -19,6 +19,9 @@ categories = [
"hacking",
"reversing",
]
aliases = [
"9"
]
+++
## Story line
@@ -0,0 +1,5 @@
+++
author = "Maik de Kruif"
title = "Beginners Quest"
description = "My Google CTF - 2021 - Beginners Quest writeups."
+++
+5
View File
@@ -0,0 +1,5 @@
+++
author = "Maik de Kruif"
title = "Google CTF"
description = "My Google CTF writeups."
+++
+1 -1
View File
@@ -5,7 +5,7 @@
<h1>{{ .Title }}</h1>
{{- if and .Content (not .Paginator.HasPrev) }}
<div class="content">{{ .Content }}</div>
<div class="content content-list">{{ .Content }}</div>
{{- end }}
{{- if .Paginator.HasPrev }}
+111 -14
View File
@@ -1,8 +1,94 @@
{{- /* <!-- Breadcrumbs --> */}}
{{- $breadcrumbs := slice }}
{{- $path := "" }}
{{- if or (eq .Kind "taxonomy") (or (eq .Kind "term") (eq .Kind "404")) }}
{{- $path = .RelPermalink }}
{{- else if .File }}
{{- $path = string .File }}
{{- else if .IsHome }}
{{- $path = "" }}
{{- else }}
{{- errorf "Could not find page at url: \"%s\"!" .RelPermalink }}
{{- end }}
{{- $path = trim $path "/" }}
{{- $currentPath := "" }}
{{- $breadcrumbs = $breadcrumbs | append (dict "name" "Home" "url" $.Site.BaseURL) }}
{{- range split $path "/" }}
{{- $currentPath = printf "%s/%s" $currentPath . }}
{{- $page := $.GetPage $currentPath }}
{{- if not $.IsHome }}
{{- if ne . "_index.md" }}
{{- if eq $.Kind "404" }}
{{- $breadcrumbs = $breadcrumbs | append (dict "name" "Not Found" "url" (printf "%s%s" $.Site.BaseURL (strings.TrimLeft "/" $currentPath))) }}
{{- else }}
{{- $title := $page.Title }}
{{- if eq $page $ }}
{{- $breadcrumbs = $breadcrumbs | append (dict "name" $title "url" $page.Permalink) }}
{{- else }}
{{- $breadcrumbs = $breadcrumbs | append (dict "name" $title "url" $page.Permalink)}}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if .IsHome }}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@context": "https://schema.org",
"@graph": [
{
"@type": "Person",
"@id": "{{ $.Site.BaseURL }}#website_founder",
"name": {{ $.Site.Author.name | safeHTML }},
{{- with $.Site.Author.email }}
"email": {{ . | safeHTML }},
{{- end }}
{{- with $.Site.Author.image }}
{{- $img := resources.Get . }}
{{- $img = $img.Resize (printf "%dx%d png" $img.Width $img.Height) }}
"image": {
"@type": "ImageObject",
"url": "{{ $img.Permalink }}",
"width": {{ $img.Width }},
"height": {{ $img.Height }}
},
{{- end }}
"url": "{{ $.Site.BaseURL }}"
},
{
"@type": "Organization",
"name": {{ $.Site.Author.name | safeHTML }},
"slogan": {{$.Site.Params.HomeSubtitle | safeHTML }},
{{- with $socials := .Site.Params.social }}
"sameAs": [
{{- range $index, $social := $socials }}
"{{ $social.url }}"{{ if ne $index (sub (len $socials) 1) }},{{ end }}
{{- end }}
],
{{- end }}
{{- with $.Site.Author.email }}
"email": {{ . | safeHTML }},
{{- end }}
{{- with $.Site.Author.image }}
{{- $img := resources.Get . }}
{{- $img = $img.Resize (printf "%dx%d png" $img.Width $img.Height) }}
"logo": {
"@type": "ImageObject",
"url": "{{ $img.Permalink }}",
"width": {{ $img.Width }},
"height": {{ $img.Height }}
},
"image": {
"@type": "ImageObject",
"url": "{{ $img.Permalink }}",
"width": {{ $img.Width }},
"height": {{ $img.Height }}
},
{{- end }}
"url": "{{ $.Site.BaseURL }}",
"founder": { "@id": "{{ $.Site.BaseURL }}#website_founder" }
},
{
"@type": "WebSite",
"inLanguage": "{{ .Site.LanguageCode }}",
{{- $img := resources.Get .Site.Params.portrait.path }}
@@ -18,7 +104,7 @@
],
"genre": "{{ .Site.Params.genre }}",
"keywords": "{{ .Site.Params.keywords }}{{ if .Params.tags }}{{ range .Params.tags }}, {{ . }}{{ end }}{{ end }}{{ with .Title }}, {{ delimit (split . " ") ", " }}{{ end }}{{ with .Params.Subtitle }}, {{ delimit (split . " ") ", " }}{{ end }}",
"url": "{{ .Permalink }}",
"url": "{{ .Site.BaseURL }}",
{{- with .Site.Copyright }}
"license": {{ . | safeHTML }},
{{- end }}
@@ -47,11 +133,24 @@
"headline": {{ .Site.Title }},
"alternativeHeadline": {{ .Site.Params.homeSubtitle }},
"description": {{ .Site.Params.description }}
}
</script>
{{- else if .IsPage }}
<script type="application/ld+json">
{
},
{
"@type": "BreadcrumbList",
"itemListElement": [
{{- range $index, $breadcrumb := $breadcrumbs }}
{
"@type": "ListItem",
"position": {{ add $index 1 }},
"item": {
"@id": "{{ $breadcrumb.url }}",
"url": "{{ $breadcrumb.url }}",
"name": "{{ $breadcrumb.name }}"
}
}{{ if ne $index (sub (len $breadcrumbs) 1) }},{{ end }}
{{- end }}
]
}{{ if .IsPage }},
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"articleSection": "{{ .Type }}",
@@ -111,11 +210,8 @@
{{- end }}
{{- end }}
"description": {{ .Params.description | plainify }}
}
</script>
{{- else if .IsSection }}
<script type="application/ld+json">
{
}{{ end }}{{ if .IsSection }},
{
"@context": "http://schema.org",
"@type": "ItemList",
"itemListOrder": "https://schema.org/ItemListOrderDescending",
@@ -190,6 +286,7 @@
}{{ if ne (sub (len $pages) 1) $index }},{{ end }}
{{- end }}
]
}{{ end }}
]
}
</script>
{{- end }}
+1 -1
View File
@@ -4,7 +4,7 @@
<h1>Portfolio</h1>
{{- if and .Content (not .Paginator.HasPrev) }}
<div class="content">{{ .Content }}</div>
<div class="content content-list">{{ .Content }}</div>
{{- end }}
<div class="portfolios-list">
+10 -2
View File
@@ -1,11 +1,19 @@
{{ define "main" }}
{{ $paginator := .Paginate .Data.Pages }}
{{- $allWriteups := slice }}
{{- range where (where .Site.Pages "Section" .Section) "IsPage" true }}
{{- if $.IsAncestor . }}
{{- $allWriteups = $allWriteups | append . }}
{{- end }}
{{- end }}
{{- $allWriteups = sort $allWriteups "Date" "desc" }}
{{ $paginator := .Paginate $allWriteups }}
<main class="posts">
<h1>{{ .Title }}</h1>
{{- if and .Content (not .Paginator.HasPrev) }}
<div class="content">{{ .Content }}</div>
<div class="content content-list">{{ .Content }}</div>
{{- end }}
{{- if .Paginator.HasPrev }}