From 8771efa29ed4f6f8015f18b908a980be0f19b474 Mon Sep 17 00:00:00 2001 From: Aadi Desai <21363892+supleed2@users.noreply.github.com> Date: Wed, 10 May 2023 12:14:33 +0100 Subject: [PATCH] Create custom index page and add social.lol link Links now have rel="noopener noreferrer me", a title set to the link text and open in a new tab --- config.yml | 2 ++ layouts/index.html | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 layouts/index.html diff --git a/config.yml b/config.yml index 467fa7e..bfd39a9 100644 --- a/config.yml +++ b/config.yml @@ -30,6 +30,8 @@ params: # Customise Guide: https://github.com/Yukuro/hugo-theme-shell/blob/maste - "https://8bit.omg.lol/" - - My /now Page - "https://8bit.omg.lol/now/" + - - Mastodon (social.lol) + - "https://social.lol/@8bit/" - - LinkedIn - "https://www.linkedin.com/in/aadidesai/" - - Peerlist diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..4ada6c6 --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,55 @@ +{{ define "main" }} + {{ $env := printf "%s@%s:~/%s$" .Site.Params.Terminal.userName .Site.Params.Terminal.pcName "" | safeHTML }} + {{ $envWithDir := printf "%s@%s:~/%s$" .Site.Params.Terminal.userName .Site.Params.Terminal.pcName .Site.Params.Terminal.workDir | safeHTML }} + + {{ $cd := printf "cd %s" .Site.Params.Terminal.workDir | safeHTML }} + {{ $cat := printf "cat %s" .Site.Params.Terminal.profile | safeHTML }} + + {{ $description := "" }} + {{ if eq (substr .Site.Params.Terminal.description -3 3) ".md" }} + {{ $s := "" }} + {{ with .Site.GetPage .Site.Params.Terminal.description }} + + {{ $s = replaceRE "]*>" "" .Content 1 }} + {{ end }} + {{ $description = printf "%s" $s | safeHTML}} + {{ else }} + {{ $limit := sub (len (findRE "\n" .Site.Params.Terminal.description)) 1 }} + {{ $description = printf "%s" .Site.Params.Terminal.description }} + {{ $description = replaceRE "\n" "
" $description $limit| safeHTML }} + {{ end }} + + {{ $tree := "" }} + {{ $leaf := "" }} + {{ if .Site.Params.Tree.use }} + {{ $tree = printf "tree ./%s/" .Site.Params.Tree.folderName | safeHTML}} + {{ $leaf = printf "%s./%s/
" $leaf .Site.Params.Tree.folderName | safeHTML}} + {{ range $index, $val := .Site.Params.Tree.files }} + {{ $ac := index $val 0}} + {{ $link := index $val 1}} + + + {{ $l := $.Site.GetPage $link }} + {{ if $l }} + {{ $link = $l.Permalink}} + {{ end }} + + {{ if eq (add $index 1) (len $.Site.Params.Tree.files) }} + {{ $leaf = printf "%s└── %s" $leaf $link $ac $ac | safeHTML}} + {{ else }} + {{ $leaf = printf "%s├── %s
" $leaf $link $ac $ac | safeHTML}} + {{ end }} + {{ end }} + {{ end }} + + {{ $end := $env }} + + {{ $payload := delimit (slice $cd $cat $description $tree $leaf $end) "" }} + + {{ $ps1Delay := $.Site.Params.Terminal.ps1Delay }} + {{ $stdoutDelay := $.Site.Params.Terminal.stdoutDelay }} + {{ $commandDelay := $.Site.Params.Terminal.commandDelay }} + + {{ partial "partials/typeIndex.html" (dict "context" . "env" $env "cd" $cd "envWithDir" $envWithDir "cat" $cat "description" $description "tree" $tree "leaf" $leaf "ps1delay" $ps1Delay "stdoutdelay" $stdoutDelay "commanddelay" $commandDelay ) }} + +{{ end }}