Skip to content

Commit

Permalink
beter htb author
Browse files Browse the repository at this point in the history
  • Loading branch information
daanbreur committed Oct 17, 2023
1 parent 25f0e93 commit b784d79
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 26 deletions.
11 changes: 11 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ params:
description: "Cheesing CTF challenges across the world."
keywords: [Blog, Cybersecurity, Hacking, Programming, HackTheBox]
author: Us
htbTeamId: 5313

DateFormat: "January 2, 2006"

Expand Down Expand Up @@ -59,6 +60,16 @@ params:
- name: ctftime
url: "https://ctftime.org/team/228090"

htbIds:
- username: status-quo
id: 431905
- username: DaanBreur
id: 317890
- username: sethboy
id: 1525345
- username: notSelwyn
id: 500469

cover:
hidden: true # hide everywhere but not in structured data
hiddenInList: true # hide on list pages and home
Expand Down
27 changes: 1 addition & 26 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,7 @@ <h1 class="post-title">
{{- end }}

<footer class="post-footer">

{{- if or .Params.author site.Params.author }}
<ul class="post-tags">
{{- $author := (.Params.author | default site.Params.author) }}
{{- $author_type := (printf "%T" $author) }}
{{- if (or (eq $author_type "[]string") (eq $author_type "[]interface {}")) }}
{{- range ($author) }}
{{- if (eq . "status-quo") }}
<li><img title="status-quo" src="https://www.hackthebox.com/badge/image/431905" /></li>
{{- end }}
{{- if (eq . "DaanBreur") }}
<li><img title="DaanBreur" src="https://www.hackthebox.com/badge/image/317890" /></li>
{{- end }}
{{- if (eq . "sethboy") }}
<li><img title="sethboy" src="https://www.hackthebox.com/badge/image/1525345" /></li>
{{- end }}
{{- if (eq . "notSelwyn") }}
<li><img title="notselwyn" src="https://www.hackthebox.com/badge/image/500469" /></li>
{{- end }}
{{- end }}
{{- else }}
{{- $author }}
{{- end }}
</ul>
{{- end -}}

{{- partial "htb_author_meta.html" . -}}
{{- $tags := .Language.Params.Taxonomies.tag | default "tags" }}
<ul class="post-tags">
{{- range ($.GetTerms $tags) }}
Expand Down
27 changes: 27 additions & 0 deletions layouts/partials/htb_author_meta.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if or .Params.author site.Params.author }}
<ul class="post-tags">
{{- $author := (.Params.author | default site.Params.author) }}
{{- $author_type := (printf "%T" $author) }}
{{- if (or (eq $author_type "[]string") (eq $author_type "[]interface {}")) }}
{{- range $author -}}
{{ $username := . }}
{{ $exists := false }}
{{ $index := -1 }}
{{- range $i, $item := $.Site.Params.htbIds -}}
{{- if eq $item.username $username -}}
{{ $exists = true }}
{{ $index = $i }}
{{- end -}}
{{- end -}}
{{- if $exists -}}
{{ $author_object := index $.Site.Params.htbIds $index }}
<li><img title="{{ $author_object.username }}" src="https://www.hackthebox.com/badge/image/{{ $author_object.id }}" /></li>
{{- end -}}
{{- end -}}
{{- else }}
{{- if (eq $author "Us") }}
<li><img title="Ducks" src="https://www.hackthebox.com/badge/team/image/{{ site.Params.htbTeamId }}" /></li>
{{- end }}
{{- end }}
</ul>
{{- end -}}

0 comments on commit b784d79

Please sign in to comment.