feat: update site
This commit is contained in:
@@ -4,7 +4,7 @@ FROM golang:1.23-alpine as builder
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy and download dependencies
|
# Copy and download dependencies
|
||||||
COPY go.mod ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
# Copy the source code
|
# Copy the source code
|
||||||
|
|||||||
6
go.mod
6
go.mod
@@ -1,3 +1,9 @@
|
|||||||
module git.yadunut.dev/yadunut/yadunut.dev
|
module git.yadunut.dev/yadunut/yadunut.dev
|
||||||
|
|
||||||
go 1.23.3
|
go 1.23.3
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/yuin/goldmark v1.7.8 // indirect
|
||||||
|
github.com/yuin/goldmark-meta v1.1.0 // indirect
|
||||||
|
gopkg.in/yaml.v2 v2.3.0 // indirect
|
||||||
|
)
|
||||||
|
|||||||
7
go.sum
Normal file
7
go.sum
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
|
||||||
|
github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
||||||
|
github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc=
|
||||||
|
github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
||||||
|
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"path"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -44,15 +45,16 @@ func (h *handler) RequestsCounterMiddleware(next http.Handler) http.Handler {
|
|||||||
func (h *handler) Ping(w http.ResponseWriter, r *http.Request) {
|
func (h *handler) Ping(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Fprintf(w, "Pong")
|
fmt.Fprintf(w, "Pong")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *handler) Index(w http.ResponseWriter, r *http.Request) {
|
func (h *handler) Index(w http.ResponseWriter, r *http.Request) {
|
||||||
h.logger.Info(r.URL.Path)
|
h.logger.Info(r.URL.Path)
|
||||||
|
|
||||||
if template, isOk := templates[r.URL.Path]; isOk {
|
if template, isOk := templates[path.Base(r.URL.Path)]; isOk {
|
||||||
h.logger.Info("Found template")
|
h.logger.Info("Found template")
|
||||||
template.ExecuteTemplate(w, "base", nil)
|
template.ExecuteTemplate(w, "base", nil)
|
||||||
} else {
|
} else {
|
||||||
h.logger.Info("default template")
|
h.logger.Info("default template")
|
||||||
templates["index.html"].ExecuteTemplate(w, "base", nil)
|
templates["index"].ExecuteTemplate(w, "base", nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,55 +1,77 @@
|
|||||||
:root {
|
:root {
|
||||||
--font-family: "Comic Mono";
|
--font-family: "Comic Mono";
|
||||||
--line-height: 1.2rem;
|
--line-height: 1.2rem;
|
||||||
--font-weight-normal: 500;
|
--font-weight-normal: 500;
|
||||||
--font-weight-medium: 600;
|
--font-weight-medium: 600;
|
||||||
--font-weight-bold: 800;
|
--font-weight-bold: 800;
|
||||||
|
|
||||||
font-family: var(--font-family), monospace;
|
font-family: var(--font-family), monospace;
|
||||||
font-weight: var(--font-weight-normal);
|
font-weight: var(--font-weight-normal);
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
line-height: var(--line-height);
|
line-height: var(--line-height);
|
||||||
max-width: 100ch;
|
max-width: 100ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1,
|
h1,
|
||||||
h2,
|
h2,
|
||||||
h3,
|
h3,
|
||||||
h4,
|
h4,
|
||||||
h5,
|
h5,
|
||||||
h6 {
|
h6 {
|
||||||
margin: calc(var(--line-height) * 2) 0 var(--line-height) 0;
|
margin: calc(var(--line-height) * 2) 0 var(--line-height) 0;
|
||||||
font-weight: var(--font-weight-bold);
|
font-weight: var(--font-weight-bold);
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
margin-bottom: calc(var(--line-height) * 2);
|
margin-bottom: calc(var(--line-height) * 2);
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
#grid {
|
#grid {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-image: linear-gradient(to right, #ccc 1px, transparent 1px),
|
background-image: linear-gradient(to right, #ccc 1px, transparent 1px),
|
||||||
linear-gradient(to bottom, #ccc 1px, transparent 1px);
|
linear-gradient(to bottom, #ccc 1px, transparent 1px);
|
||||||
background-size: 1ch var(--line-height); /* Adjust grid size */
|
background-size: 1ch var(--line-height);
|
||||||
background-position: top left;
|
/* Adjust grid size */
|
||||||
margin: 0;
|
background-position: top left;
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
margin-bottom: var(--line-height);
|
margin-bottom: var(--line-height);
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
padding: 0 0 0 2ch;
|
||||||
|
margin: 0 0 var(--line-height);
|
||||||
|
list-style-type: square;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul li ul {
|
||||||
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"html/template"
|
"html/template"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"path"
|
"path"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -14,24 +15,28 @@ var templates map[string]*template.Template
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
templates = make(map[string]*template.Template)
|
templates = make(map[string]*template.Template)
|
||||||
fs.WalkDir(templateContent, "templates", func(p string, d fs.DirEntry, err error) error {
|
fs.WalkDir(templateDir, "templates", func(p string, d fs.DirEntry, err error) error {
|
||||||
if d.IsDir() || !strings.HasSuffix(p, ".html") {
|
if d.IsDir() || !strings.HasSuffix(p, ".html") {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
basePath := path.Base(p)
|
basePath := strings.TrimSuffix(path.Base(p), filepath.Ext(p))
|
||||||
templates[basePath] = template.Must(template.ParseFS(templateContent, p, "templates/_layout.html.tmpl"))
|
|
||||||
fmt.Println(path.Base(p))
|
templates[basePath] = template.Must(template.ParseFS(templateDir, p, "templates/_layout.html.tmpl"))
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
fmt.Printf("successfully parsed templates: ")
|
fmt.Println("Parsed templates")
|
||||||
for k, t := range templates {
|
for k, ts := range templates {
|
||||||
fmt.Printf("%s: %s \n", k, t.Name())
|
fmt.Printf("%s: ", k)
|
||||||
|
for _, t := range ts.Templates() {
|
||||||
|
fmt.Printf("%s ", t.Name())
|
||||||
|
}
|
||||||
|
fmt.Println()
|
||||||
}
|
}
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:embed templates/*
|
//go:embed templates/*
|
||||||
var templateContent embed.FS
|
var templateDir embed.FS
|
||||||
|
|
||||||
//go:embed static/*
|
//go:embed static/*
|
||||||
var staticContent embed.FS
|
var staticContent embed.FS
|
||||||
|
|||||||
@@ -11,5 +11,8 @@
|
|||||||
{{ template "content" .}}
|
{{ template "content" .}}
|
||||||
<div id="grid"></div>
|
<div id="grid"></div>
|
||||||
</body>
|
</body>
|
||||||
|
<footer>
|
||||||
|
Website design inspired by and shamelessly stolen from <a href="https://owickstrom.github.io/the-monospace-web/">The monospace web </a>
|
||||||
|
</footer>
|
||||||
</html>
|
</html>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
@@ -1,12 +1,36 @@
|
|||||||
{{ define "content" }}
|
{{ define "content" }}
|
||||||
<h1>Yadunand's Site WIP 🚧</h1>
|
<h1>Yadunand's Site WIP 🚧</h1>
|
||||||
<p>Body</p>
|
<p>Hi, I'm Yadunand, a software engineer currently based in 🇨🇦, previously in 🇭🇰,🇦🇺,🇸🇬. I'm interested in how
|
||||||
<h2>Header 2</h2>
|
companies build things that scale, and how infrastructure works in general. This site is built on the exploration of
|
||||||
<p>Body</p>
|
that. Most of my work (including <a href="https://git.yadunut.dev/yadunut/yadunut.dev">this site</a>, and the <a
|
||||||
<h3>Header 3</h3>
|
href="https://git.yadunut.dev/yadunut/homelab">infrastructure</a>) can be found on my <a
|
||||||
<p>Body</p>
|
href="https://git.yadunut.dev/yadunut">gitea</a></p>
|
||||||
<h4>Header 4</h4>
|
<h2>Currently</h2>
|
||||||
<p>Body</p>
|
<ul>
|
||||||
<h5>Header 5</h5>
|
<li>Software Engineer at <a href="https://endorhealth.com/">Endor Health</a>
|
||||||
<p></p>
|
<ul>
|
||||||
|
<li>React Native, Typescript</li>
|
||||||
|
<li>Python, flask</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>Year 3 student at <a href="https://www.nus.edu.sg/">National University of Singapore</a></li>
|
||||||
|
<li>Exchange Student at <a href="https://www.utoronto.ca/">University of Toronto</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>Previously</h2>
|
||||||
|
<ul>
|
||||||
|
<li>Technology Intern at <a href="https://www.mwam.com/">Marshall Wace</a>
|
||||||
|
<ul>
|
||||||
|
<li>Python, FastAPI</li>
|
||||||
|
<li>React, Typescript</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>Software Engineer at <a href="https://www.undertide.co/">Undertide</a></li>
|
||||||
|
<ul>
|
||||||
|
<li>React Native, Graphql, Typescript</li>
|
||||||
|
</ul>
|
||||||
|
</ul>
|
||||||
|
<h2>Contact Me</h2>
|
||||||
|
<p>I'm always happy to chat, feel free to reach out to me a @yadunut on (Twitter, Instagram, Telegram) or on <a href="mailto:me@yadunut.com">email</a></p>
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
3
site/templates/something.html
Normal file
3
site/templates/something.html
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{{ define "content" }}
|
||||||
|
<h1>Something goes here</h1>
|
||||||
|
{{ end }}
|
||||||
Reference in New Issue
Block a user