Template
1
0
Fork 0
This commit is contained in:
Atridad Lahiji 2024-10-23 15:04:26 -06:00
parent 61c969c9de
commit 8d29cc2b1a
Signed by: atridad
SSH key fingerprint: SHA256:LGomp8Opq0jz+7kbwNcdfTcuaLRb5Nh0k5AchDDb438
11 changed files with 121 additions and 11 deletions

View file

@ -14,5 +14,5 @@ This is my personal website!
1. Run ```go get```
2. Duplicate the .env.example file and call it .env
3. Fill out the required .env values
4. Run ```go install github.com/cosmtrek/air@latest``` to download Air for live reload
4. Run ```go install github.com/air-verse/air@latest``` to download Air for live reload
5. Run ```air``` to start the dev server (macOS and Linux only)

2
go.mod
View file

@ -1,6 +1,6 @@
module atri.dad
go 1.23.1
go 1.23
require (
github.com/alecthomas/chroma/v2 v2.14.0

View file

@ -51,6 +51,7 @@ func main() {
e.GET("/", pages.Home)
e.GET("/projects", pages.Projects)
e.GET("/talks", pages.Talks)
e.GET("/pubs", pages.Pubs)
e.GET("/posts", pages.Posts)
e.GET("/posts/:post", pages.Post)
e.GET("/tools", pages.Tools)

24
pages/pubs.go Normal file
View file

@ -0,0 +1,24 @@
package pages
import (
"atri.dad/lib"
"github.com/labstack/echo/v4"
)
type PubProps struct {
Pubs []lib.CardLink
}
func Pubs(c echo.Context) error {
pubs := []lib.CardLink{}
props := PubProps{
Pubs: pubs,
}
// Specify the partials used by this page
partials := []string{"header", "navitems", "cardlinks"}
// Render the template
return lib.RenderTemplate(c.Response().Writer, "base", partials, props)
}

View file

@ -5,6 +5,9 @@
<li>
<a class="no-underline" href="/projects"> Projects </a>
</li>
<li>
<a class="no-underline" href="/pubs"> Publications </a>
</li>
<li>
<a class="no-underline" href="/talks"> Talks </a>
</li>

View file

@ -11,6 +11,8 @@ Atridad Lahiji // Blog
{{end}}
{{define "main"}}
{{if .Posts}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
{{range .Posts}}
{{template "cardlinks" .}}
@ -18,5 +20,15 @@ Atridad Lahiji // Blog
</section>
{{end}}
{{if not .Posts}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
<h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-[2rem]">
Nothing to see here (yet)!
</h2>
</section>
{{end}}
{{end}}
{{define "foot"}}
{{end}}

View file

@ -11,6 +11,8 @@ Atridad Lahiji // Projects
{{end}}
{{define "main"}}
{{if .Projects}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
{{range .Projects}}
{{template "cardlinks" .}}
@ -18,5 +20,15 @@ Atridad Lahiji // Projects
</section>
{{end}}
{{if not .Projects}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
<h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-[2rem]">
Nothing to see here (yet)!
</h2>
</section>
{{end}}
{{end}}
{{define "foot"}}
{{end}}

34
pages/templates/pubs.html Normal file
View file

@ -0,0 +1,34 @@
{{define "title"}}
Atridad Lahiji // Publications
{{end}}
{{define "headercontent"}}
Atridad Lahiji // Publications
{{end}}
{{define "head"}}
<link rel="stylesheet" href="/public/css/styles.css" />
{{end}}
{{define "main"}}
{{if .Pubs}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
{{range .Pubs}}
{{template "cardlinks" .}}
{{end}}
</section>
{{end}}
{{if not .Pubs}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
<h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-[2rem]">
Nothing to see here (yet)!
</h2>
</section>
{{end}}
{{end}}
{{define "foot"}}
{{end}}

View file

@ -11,6 +11,8 @@ Atridad Lahiji // Talks
{{end}}
{{define "main"}}
{{if .Talks}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
{{range .Talks}}
{{template "cardlinks" .}}
@ -18,5 +20,15 @@ Atridad Lahiji // Talks
</section>
{{end}}
{{if not .Talks}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
<h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-[2rem]">
Nothing to see here (yet)!
</h2>
</section>
{{end}}
{{end}}
{{define "foot"}}
{{end}}

View file

@ -11,6 +11,8 @@ Atridad Lahiji // Tools
{{end}}
{{define "main"}}
{{if .Tools}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
{{range .Tools}}
{{template "cardlinks" .}}
@ -18,5 +20,15 @@ Atridad Lahiji // Tools
</section>
{{end}}
{{if not .Tools}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
<h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-[2rem]">
Nothing to see here (yet)!
</h2>
</section>
{{end}}
{{end}}
{{define "foot"}}
{{end}}

File diff suppressed because one or more lines are too long