1
0
mirror of https://github.com/avinal/avinal.github.io.git synced 2026-07-04 07:40:09 +05:30

added hugo website

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>

rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED
This commit is contained in:
2024-03-30 12:44:19 +05:30
parent 1c20213cd4
commit a196ac4391
100 changed files with 7832 additions and 0 deletions
@@ -0,0 +1,3 @@
<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }}
<a href="#{{ .Anchor | safeURL }}">#</a>
</h{{ .Level }}>
+18
View File
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="{{ or site.Language.LanguageCode site.Language.Lang }}"
dir="{{ or site.Language.LanguageDirection `ltr` }}">
<head>
{{ partial "head.html" . }}
</head>
<body class="bg-neutral-800">
<main class="container mx-auto">
{{ block "main" . }}{{ end }}
<footer>
{{ partial "footer.html" . }}
</footer>
</main>
</body>
</html>
+7
View File
@@ -0,0 +1,7 @@
{{ define "main" }}
{{ .Content }}
{{ range site.RegularPages }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ .Summary }}
{{ end }}
{{ end }}
+82
View File
@@ -0,0 +1,82 @@
{{ define "main" }}
<div
class="prose prose-invert mx-auto lg:prose-lg prose-a:decoration-cyan-500 hover:prose-a:decoration-pink-500 text-white">
<div class="md:-mx-8 lg:-mx-16 px-8 py-1">
<h1 class="text-5xl font-bold mb-6 mt-12 text-center">{{ .Title }}</h1>
{{ .Content }}
</div>
</div>
<section class="text-gray-100">
<div class="max-w-6xl p-6 mx-auto space-y-6 sm:space-y-12 mb-16">
{{ range first 1 .Pages }}
<div
class="block max-x-sm gap-3 mx-auto sm:max-w-full group hover:no-underline focus:no-underline lg:grid lg:grid-cols-12 bg-neutral-900">
<a class="lg:col-span-7" href="{{ .RelPermalink }}">
<img class="object-cover w-full h-64 rounded sm:h-96 lg:col-span-7" src="{{ .Params.Image | absURL }}"
alt="{{ .LinkTitle }}">
</a>
<div class="p-6 space-y-2 lg:col-span-5">
<a href="{{ .RelPermalink }}">
<h3 class="text-2xl font-semibold sm:text-4xl group-hover:underline group-focus:underline">{{ .LinkTitle }}
</h3>
{{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
{{ $dateHuman := .Date | time.Format ":date_long" }}
<time datetime="{{ $dateMachine }}" class="text-gray-400">{{ $dateHuman }}</time>
{{ if gt .ReadingTime 1 }}
{{ .Scratch.Set "timeUnit" "mins" }}
{{ else }}
{{ .Scratch.Set "timeUnit" "min" }}
{{ end }}
{{ if .Site.Params.showReadingTime }}
<span class="text-gray-400"> | ~{{.ReadingTime}} {{ .Scratch.Get "timeUnit" }}</span>
{{ end }}
<p> {{ .Summary | truncate 250 }}</p>
</a>
<a href="" target="_blank">
<span class="flex flex-wrap py-6 space-x-2">
<a class="px-3 py-1 m-1 rounded-sm hover:underline bg-pink-400 text-gray-900 font-bold" href="/posts/category/{{ .Params.Category }}">
{{ .Params.Category }}</a>
</span>
</a>
</div>
</div>
{{ end }}
<div class="grid justify-center grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
{{ range after 1 .Pages }}
<div class="max-w-sm mx-auto group hover:no-underline focus:no-underline bg-neutral-900">
<a href="{{ .RelPermalink }}">
<img class="object-cover w-full h-44 rounded" src="{{ .Params.Image | absURL }}" alt="{{ .LinkTitle }}">
</a>
<div class="p-6 space-y-2">
<a href="{{ .RelPermalink }}">
<h3 class="text-2xl font-semibold group-hover:underline group-focus:underline">{{ .LinkTitle }}</h3>
{{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
{{ $dateHuman := .Date | time.Format ":date_long" }}
<time datetime="{{ $dateMachine }}" class="text-gray-400">{{ $dateHuman }}</time>
{{ if gt .ReadingTime 1 }}
{{ .Scratch.Set "timeUnit" "mins" }}
{{ else }}
{{ .Scratch.Set "timeUnit" "min" }}
{{ end }}
{{ if .Site.Params.showReadingTime }}
<span class="text-gray-400"> | ~{{.ReadingTime}} {{ .Scratch.Get "timeUnit" }}</span>
{{ end }}
<p> {{ .Summary | truncate 150 }}</p>
</a>
<a href="" target="_blank">
<span class="flex flex-wrap py-6 space-x-2">
<a class="px-3 py-1 m-1 rounded-sm hover:underline bg-pink-400 text-gray-900 font-bold" href="/posts/category/{{ .Params.Category }}">
{{ .Params.Category }}</a>
</span>
</a>
</div>
</div>
{{ end }}
</div>
</div>
</section>
{{ end }}
+32
View File
@@ -0,0 +1,32 @@
{{ define "main" }}
<div class="min-h-screen flex flex-col justify-center relative overflow-hidden">
<div class="relative w-full bg-neutral md:max-w-3xl md:mx-auto lg:max-w-4xl lg:pb-28">
<div class="prose prose-invert mx-auto lg:prose-lg prose-a:decoration-cyan-500 hover:prose-a:decoration-pink-500">
<div class="bg-neutral-900 md:-mx-8 lg:-mx-16 px-8 py-1">
{{ partial "header.html" . }}
<article>
{{ if cond (ne .Params.toc nil) .Params.toc .Site.Params.toc }}
{{ if ne .TableOfContents "<nav id=\"TableOfContents\"></nav>" }}
<details class="open:bg-neutral-800 open:border open:rounded open:border-cyan-700 ">
<summary>
<b>In this post, we'll take a look at:</b>
</summary>
<div class="toc {{ if .Site.Params.numberedSubtitles }}numbered-subtitles{{ end }} ">{{ .TableOfContents }}
</div>
</details>
{{ end }}
{{ end }}
{{ .Content }}
</article>
{{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
</div>
</div>
{{ partial "comments.html" . (dict "taxonomy" "tags" "page" .) }}
</div>
</div>
{{ end }}
+1
View File
@@ -0,0 +1 @@
<div id="remark42" class="md:p-4 mb-16"></div>
+8
View File
@@ -0,0 +1,8 @@
<div class="fixed bottom-0 left-0 bg-neutral-900 p-3 w-full border-t border-cyan-500">
<div class="mx-auto flex justify-center space-x-6 text-gray-400">
{{ range .Site.Params.navs }}
<a class="underline decoration-cyan-500 hover:decoration-pink-500 text-xl" href="{{ .link | safeURL }}">{{ .name
}}</a>
{{ end }}
</div>
</div>
+28
View File
@@ -0,0 +1,28 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title itemprop="name">{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}
</title>
{{ if eq .Section "posts" }}
<meta property="og:title" content="{{ .Title }} | {{ .Site.Title }}" />
<meta name="twitter:title" content="{{ .Title }} | {{ .Site.Title }}" />
<meta itemprop="name" content="{{ .Title }} | {{ .Site.Title }}" />
<meta name="application-name" content="{{ .Title }} | {{ .Site.Title }}" />
<meta property="og:site_name" content="{{ .Site.Params.sitename }}" />
<meta name="description" content="{{ .Params.description }}" />
<meta itemprop="description" content="{{ .Params.description }}" />
<meta property="og:description" content="{{ .Params.description }}" />
<meta name="twitter:description" content="{{ .Params.description }}" />
{{ with .Params.image }}
<meta itemprop="image" content="{{ . | absURL }}" />
<meta property="og:image" content="{{ . | absURL }}" />
<meta name="twitter:image" content="{{ . | absURL }}" />
<meta name="twitter:image:src" content="{{ . | absURL }}" />
{{ else }}
<meta itemprop="image" content="{{ .Site.Params.ogimage | absURL }}" />
<meta property="og:image" content="{{ .Site.Params.ogimage | absURL }}" />
<meta name="twitter:image" content="{{ .Site.Params.ogimage | absURL }}" />
<meta name="twitter:image:src" content="{{ .Site.Params.ogimage | absURL }}" />
{{ end }}
{{ end }}
{{ partialCached "head/css.html" . }}
{{ partialCached "head/js.html" . }}
+9
View File
@@ -0,0 +1,9 @@
{{- with resources.Get "css/main.css" }}
{{- if eq hugo.Environment "development" }}
<link rel="stylesheet" href="{{ .RelPermalink }}">
{{- else }}
{{- with . | minify | fingerprint }}
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
{{- end }}
{{- end }}
{{- end }}
+12
View File
@@ -0,0 +1,12 @@
{{- with resources.Get "js/main.js" }}
{{- if eq hugo.Environment "development" }}
{{- with . | js.Build }}
<script src="{{ .RelPermalink }}"></script>
{{- end }}
{{- else }}
{{- $opts := dict "minify" true }}
{{- with . | js.Build $opts | fingerprint }}
<script src="{{ .RelPermalink }}" integrity="{{- .Data.Integrity }}" crossorigin="anonymous"></script>
{{- end }}
{{- end }}
{{- end }}
+25
View File
@@ -0,0 +1,25 @@
<header class="relative">
<img class="object-cover w-full h-60 sm:h-96 brightness-50" src="{{ .Params.Image | absURL }}" alt="{{ .Title }}">
<h1 class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-center w-full text-white">{{ .Title }}</h1>
<span class="absolute bottom-1/4 left-1/2 -translate-x-1/2 text-base font-sans oldstyle-nums text-center w-full">
<a class="font-bold no-underline hover:text-pink-500" href="/">Avinal Kumar</a>
|
{{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
{{ $dateHuman := .Date | time.Format ":date_long" }}
<time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
{{ if .Site.Params.showWordCount }}
<span>| {{ .WordCount }} words</span>
{{ end }}
{{ if gt .ReadingTime 1 }}
{{ .Scratch.Set "timeUnit" "mins" }}
{{ else }}
{{ .Scratch.Set "timeUnit" "min" }}
{{ end }}
{{ if .Site.Params.showReadingTime }}
<span>| ~{{.ReadingTime}} {{ .Scratch.Get "timeUnit" }}</span>
{{ end }}
</span>
</header>
+51
View File
@@ -0,0 +1,51 @@
{{- /*
Renders a menu for the given menu ID.
@context {page} page The current page.
@context {string} menuID The menu ID.
@example: {{ partial "menu.html" (dict "menuID" "main" "page" .) }}
*/}}
{{- $page := .page }}
{{- $menuID := .menuID }}
{{- with index site.Menus $menuID }}
<nav>
<ul>
{{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
</ul>
</nav>
{{- end }}
{{- define "partials/inline/menu/walk.html" }}
{{- $page := .page }}
{{- range .menuEntries }}
{{- $attrs := dict "href" .URL }}
{{- if $page.IsMenuCurrent .Menu . }}
{{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }}
{{- else if $page.HasMenuCurrent .Menu .}}
{{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }}
{{- end }}
{{- $name := .Name }}
{{- with .Identifier }}
{{- with T . }}
{{- $name = . }}
{{- end }}
{{- end }}
<li>
<a
{{- range $k, $v := $attrs }}
{{- with $v }}
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
{{- end }}
{{- end -}}
>{{ $name }}</a>
{{- with .Children }}
<ul>
{{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}
</ul>
{{- end }}
</li>
{{- end }}
{{- end }}
+22
View File
@@ -0,0 +1,22 @@
{{- /*
For a given taxonomy, renders a list of terms assigned to the page.
@context {page} page The current page.
@context {string} taxonomy The taxonony.
@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
*/}}
{{- $page := .page }}
{{- $taxonomy := .taxonomy }}
{{- with $page.GetTerms $taxonomy }}
{{- $label := (index . 0).Parent.LinkTitle }}
<span class="flex flex-wrap py-6 space-x-2 border-t border-gray-500">
<!-- <a class="px-3 py-1 m-1 rounded-sm hover:underline bg-pink-400 text-gray-900 font-bold" href="/category/"></a> -->
{{- range . }}
<a class="px-3 py-1 m-1 rounded-sm bg-cyan-500 text-gray-900" href="{{ .RelativeLink }}">#{{ .LinkTitle }}</a>
{{- end }}
</span>
{{- end }}