revamp projects, continue editing and add precommit hook for lastmod frontmatter

This commit is contained in:
2026-02-02 23:13:56 -07:00
parent 23a44c1e4f
commit 2fad7c173b
16 changed files with 357 additions and 47 deletions
+14 -14
View File
@@ -1,18 +1,18 @@
{{ define "main" }}
<div class="container">
<h1>All posts for {{ .Type | singularize }} "{{ .Title }}"</h1>
</br>
{{ range .Data.Pages }}
<div class="post-entry">
<a href="{{ .Permalink }}">
<div style="display:flex;flex-direction:row; justify-content: space-between;">
<h3>{{ .Title }}</h3>
<p>{{ .Date | time.Format ":date_medium" }}</p>
</div>
</br>
<p>{{ .Summary }}</p>
</a>
</div>
{{ end }}
<h1>All posts for {{ .Type | singularize }} "{{ .Title }}"</h1>
</br>
{{ range .Data.Pages }}
<div class="post-entry">
<a href="{{ .Permalink }}">
<div style="display:flex;flex-direction:row; justify-content: space-between;">
<h3>{{ .Title }}</h3>
<p>{{ .Date | time.Format ":date_medium" }}</p>
</div>
</a>
<p>{{ .Params.Description }}</p>
</div>
</br>
{{ end }}
</div>
{{ end}}
+71
View File
@@ -0,0 +1,71 @@
{{ define "main" }}
<section class="home-about">
<div class="avatar">
{{ if isset .Site.Params "avatarurl" }}
<img class={{ .Site.Params.AvatarSize | default "size-m" }} src='{{ .Scratch.Get "avatarImgSrc" }}'
alt="{{ .Site.Params.AvatarAltText|default " avatar" }}">
{{ end }}
</div>
<h1>{{ .Site.Title }}</h1>
{{ if isset .Site.Params "description" }}
<h2>{{ .Site.Params.Description }}</h2>
{{ end }}
</section>
<div class="flex-break"></div>
{{ if isset .Site.Params "socialicons" }}
<div class="gk-social-icons">
<ul class="gk-social-icons-list">
{{ range .Site.Params.SocialIcons }}
<li class="gk-social-icon">
<a href="{{ .url }}" {{ if .rel }}rel="{{ .rel }}" {{ end }} aria-label="Learn more on {{ .name }}">
<img class="svg-inject" src="{{ relURL " svg/icons/" }}{{ .name | lower }}.svg" alt="">
</a>
</li>
{{ end }}
</ul>
</div>
{{ end }}
{{ if os.FileExists "index-about.md" }}
<div class="markdown-content">
{{ readFile "index-about.md" | markdownify }}
</div>
{{ end }}
{{ if isset .Site.Params "showpostsonhomepage" }}
<div class="home-posts list-posts">
<h2>Recent Posts</h2>
{{ $posts := where .Site.Pages "Params.type" "post" }}
{{ if eq .Site.Params.ShowPostsOnHomePage "popular" }}
{{ range $posts.ByWeight | first (or .Site.Params.NumberPostsOnHomePage 4) }}
{{- partial "list-posts.html" . -}}
{{ end }}
{{ else if eq .Site.Params.ShowPostsOnHomePage "recent" }}
{{ range $posts.ByDate.Reverse | first (or .Site.Params.NumberPostsOnHomePage 4) }}
{{- partial "list-posts.html" . -}}
{{ end }}
{{ end }}
</div>
{{ end }}
{{/* TILs Section */}}
{{ $tils := where .Site.Pages "Params.type" "tils" }}
{{ $tilsToShow := $tils.ByDate.Reverse | first (or .Site.Params.NumberTilsOnHomePage 3) }}
{{ if gt (len $tilsToShow) 0 }}
<div class="home-posts list-posts">
<h2>Recent TILs</h2>
{{ range $tilsToShow }}
{{- partial "list-posts.html" . -}}
{{ end }}
</div>
{{ end }}
{{ end }}
+62
View File
@@ -0,0 +1,62 @@
{{ define "main" }}
<style>
.status-badge {
display: inline-block;
padding: 2px 8px;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 500;
margin-left: 0.5rem;
vertical-align: middle;
}
.status-active {
background-color: rgba(76, 175, 80, 0.15);
color: #4caf50;
border: 1px solid #4caf50;
}
.status-inactive {
background-color: rgba(158, 158, 158, 0.15);
color: #9e9e9e;
border: 1px solid #9e9e9e;
}
.project-date {
font-size: 0.85rem;
color: var(--light-secondary-color);
margin-left: 0.5rem;
}
</style>
<div class="container">
<h1 class="page-title">{{ .Title }}</h1>
{{ .Content }}
<div class="posts-list">
{{ range .Pages }}
<article class="post-entry">
<header class="entry-header">
<h3 class="entry-title">
<a href="{{ .Permalink }}" rel="bookmark">{{ .Title }}</a>
{{ if .Params.active }}
<span class="status-badge status-active">Active</span>
{{ else }}
<span class="status-badge status-inactive">Inactive</span>
{{ end }}
<span class="project-date">Updated {{ .Lastmod.Format "Jan 2, 2006" }}</span>
</h3>
</header>
{{ with .Description }}
<div class="entry-summary">{{ . }}</div>
{{ end }}
</article>
{{ end }}
</div>
{{ if eq (len .Pages) 0 }}
<p>No projects yet.</p>
{{ end }}
</div>
{{ end }}
+122
View File
@@ -0,0 +1,122 @@
{{ define "main" }}
<style>
.status-badge {
display: inline-block;
padding: 2px 8px;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 500;
margin-left: 0.5rem;
vertical-align: middle;
}
.status-active {
background-color: rgba(76, 175, 80, 0.15);
color: #4caf50;
border: 1px solid #4caf50;
}
.status-inactive {
background-color: rgba(158, 158, 158, 0.15);
color: #9e9e9e;
border: 1px solid #9e9e9e;
}
.post-image {
display: flex;
justify-content: center;
margin: 1.5rem 0;
}
.post-image img {
height: auto;
border-radius: 8px;
border: 1.5px solid var(--light-secondary-color);
box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 8px;
object-fit: cover;
}
.image-caption p {
display: flex;
justify-content: center;
}
@media (max-width: 480px) {
.post-image img {
width: 100%;
max-width: 300px;
}
}
@media (min-width: 481px) and (max-width: 768px) {
.post-image img {
width: 80%;
max-width: 400px;
}
}
@media (min-width: 769px) {
.post-image img {
width: 60%;
max-width: 500px;
}
}
</style>
<div class="post container">
<div class="post-header-section">
<h1>
{{ .Title | markdownify }}
{{ if .Params.active }}
<span class="status-badge status-active">Active</span>
{{ else }}
<span class="status-badge status-inactive">Inactive</span>
{{ end }}
</h1>
{{ with .Description }}
<small role="doc-subtitle">{{ . }}</small>
{{ end }}
<p class="post-date">
Started {{ dateFormat (or .Site.Params.dateFormat "January 2, 2006") .Date }}
{{ if lt .Date .Lastmod }} | Updated {{ dateFormat (or .Site.Params.dateFormat "January 2, 2006") .Lastmod }}{{ end }}
</p>
<ul class="post-tags">
{{ range .Params.Tags }}
<li class="post-tag"><a href="{{ "tags/" | absLangURL }}{{ . | urlize }}">{{ . }}</a></li>
{{ end }}
</ul>
</div>
{{ if .Params.image }}
<div class="post-image">
<img src="{{ .Params.image | absURL }}" alt="{{ .Params.image_alt | default .Title }}">
</div>
<div class="image-caption">
<p>{{ .Params.image_caption }}</p>
</div>
{{ end }}
<div class="post-content">
{{ .Content }}
</div>
<div class="prev-next">
{{ if eq .Site.Params.TogglePreviousAndNextButtons "true" }}
{{ if or .PrevInSection .NextInSection }}
{{ partial "prev-next.html" . }}
{{ end }}
{{ end }}
</div>
{{ if .Site.Params.ShowBackToTopButton }}
{{ partial "back-to-top.html" . }}
{{ end }}
</div>
{{- partial "toc.html" . -}}
{{ end }}