Template
1
0
Fork 0

Re-wrote based on my personal site

This commit is contained in:
Atridad Lahiji 2024-11-03 17:01:48 -06:00
parent 9dad47b960
commit 10cc09fed1
Signed by: atridad
SSH key fingerprint: SHA256:LGomp8Opq0jz+7kbwNcdfTcuaLRb5Nh0k5AchDDb438
35 changed files with 185 additions and 309 deletions

View file

@ -1,4 +1,4 @@
**/atri.dad
**/goth.stack
**/.env
**/airbin
**/tmp

2
.gitignore vendored
View file

@ -1,4 +1,4 @@
atri.dad
goth.stack
main
.env
airbin

View file

@ -1,18 +1,30 @@
# atri.dad
This is my personal website!
# GOTH Stack
## Stack:
- Backend: Golang + Echo
- Rendering: Golang templates
- Style: TailwindCSS + DaisyUI
- Content format: Markdown
A modern web application stack combining:
- Go (Backend)
- HTMX (Frontend Interactivity)
- Tailwind CSS (Styling)
## Requirements:
- Golang 1.23.1
## Features
- Server-Side Rendering
- Real-time capabilities with SSE
- Built-in tools and utilities
- API documentation with Swagger
- Modern responsive design
- Zero client-side JavaScript (optional)
## Instructions:
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/air-verse/air@latest``` to download Air for live reload
5. Run ```air``` to start the dev server (macOS and Linux only)
## Getting Started
1. Clone this repository
2. Copy `.env.example` to `.env`
3. Run `go mod download`
4. Start the server: `go run main.go`
## API Documentation
1. Install swag by running ```go install github.com/swaggo/swag/cmd/swag@latest```
2. Visit `/api/swagger/index.html` after starting the server
## Example Posts
Check out the `/posts` route for blogging examples
## License
MIT

View file

@ -15,10 +15,10 @@ import (
"strings"
"time"
contentfs "atri.dad/content"
"atri.dad/lib"
"github.com/gorilla/feeds"
"github.com/labstack/echo/v4"
contentfs "goth.stack/content"
"goth.stack/lib"
)
func RSSFeedHandler(c echo.Context) error {

View file

@ -4,8 +4,8 @@ import (
"fmt"
"time"
"atri.dad/lib"
"github.com/labstack/echo/v4"
"goth.stack/lib"
)
// SSE godoc

View file

@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"atri.dad/lib"
"goth.stack/lib"
"github.com/labstack/echo/v4"
)

View file

@ -3,7 +3,7 @@ package api
import (
"net/http"
"atri.dad/lib"
"goth.stack/lib"
"github.com/labstack/echo/v4"
)

View file

@ -1,9 +1,105 @@
---
name: "Welcome!"
date: "October 20 2024"
tags: ["welcome"]
name: "Welcome to GOTH Stack!"
date: "April 20 2069"
tags: ["markdown", "demo", "goth-stack"]
---
Welcome to my site! This is a place for me to share my thoughts and updates on my projects. I hope you find something interesting here.
# Welcome to GOTH Stack!
Feel free to reach out if you have any questions or comments. I'd love to hear from you! I can be reached by email at [me@atri.dad](mailto:me@atri.dad).
This is a demo post showcasing various Markdown features supported by this template.
## Text Formatting
You can write text in **bold**, *italic*, or ***both***. You can also use ~~strikethrough~~ and `inline code`.
## Links and Images
### Links
- [External Link](https://github.com/yourusername/goth.stack)
- [Internal Link](/docs)
- [Email Link](mailto:example@goth.stack)
### Images
![GOTH Stack Logo](https://via.placeholder.com/150)
## Lists
### Unordered List
- First item
- Second item
- Nested item
- Another nested item
- Third item
### Ordered List
1. First step
2. Second step
1. Nested step
2. Another nested step
3. Third step
## Code Blocks
### Inline Code
Use `go run main.go` to start the server.
### Code Block with Syntax Highlighting
```go
package main
import "fmt"
func main() {
fmt.Println("Hello, GOTH Stack!")
}
```
## Blockquotes
> This is a blockquote
>
> It can span multiple lines
>> And can be nested
## Tables
| Feature | Description |
|---------|-------------|
| Go | Backend server |
| HTMX | Frontend interactivity |
| Tailwind | Styling |
## Task Lists
- [x] Create project structure
- [x] Add basic documentation
- [ ] Write more examples
- [ ] Add testing
## Horizontal Rule
---
## Extended Features
### Collapsible Section
<details>
<summary>Click to expand</summary>
This content is hidden by default but can be revealed by clicking.
</details>
### Custom HTML (if enabled)
<div class="alert alert-info">
This is a custom styled alert using Tailwind/DaisyUI classes
</div>
## Getting Help
If you have questions or need assistance:
1. Visit our [GitHub repository](https://github.com/atridadl/goth.stack)
2. Contact us at [help@goth.stack](mailto:me@atri.dad)
---
*This is a demo post showing the Markdown capabilities of GOTH Stack. Feel free to use it as a reference for your own content.*

View file

@ -209,8 +209,8 @@ var SwaggerInfo = &swag.Spec{
Host: "localhost:3000",
BasePath: "/api",
Schemes: []string{},
Title: "Atri.dad API",
Description: "This is the API for atri.dad",
Title: "GOTH Stack API",
Description: "This is the API for GOTH Stack - Go + HTMX + Tailwind",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",

View file

@ -1,8 +1,8 @@
{
"swagger": "2.0",
"info": {
"description": "This is the API for atri.dad",
"title": "Atri.dad API",
"description": "This is the API for GOTH Stack - Go + HTMX + Tailwind",
"title": "GOTH Stack API",
"contact": {},
"version": "1.0"
},

View file

@ -2,8 +2,8 @@ basePath: /api
host: localhost:3000
info:
contact: {}
description: This is the API for atri.dad
title: Atri.dad API
description: This is the API for GOTH Stack - Go + HTMX + Tailwind
title: GOTH Stack API
version: "1.0"
paths:
/ping:

View file

@ -3,7 +3,7 @@
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = 'atridotdad'
app = 'gothstack'
primary_region = 'ord'
[build]

2
go.mod
View file

@ -1,4 +1,4 @@
module atri.dad
module goth.stack
go 1.23

View file

@ -6,7 +6,7 @@ import (
"path/filepath"
"runtime"
templatefs "atri.dad/pages/templates"
templatefs "goth.stack/pages/templates"
)
func RenderTemplate(w http.ResponseWriter, layout string, partials []string, props interface{}) error {

15
main.go
View file

@ -6,23 +6,23 @@ import (
"fmt"
"net/http"
"atri.dad/api"
"atri.dad/lib"
"atri.dad/pages"
"goth.stack/api"
"goth.stack/lib"
"goth.stack/pages"
_ "atri.dad/docs"
"github.com/joho/godotenv"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
echoSwagger "github.com/swaggo/echo-swagger"
_ "goth.stack/docs"
)
//go:embed public/*
var PublicFS embed.FS
// @title Atri.dad API
// @title GOTH Stack API
// @version 1.0
// @description This is the API for atri.dad
// @description This is the API for GOTH Stack - Go + HTMX + Tailwind
// @host localhost:3000
// @BasePath /api
func main() {
@ -49,9 +49,6 @@ func main() {
// Page routes
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)

View file

@ -1,7 +1,7 @@
package pages
import (
"atri.dad/lib"
"goth.stack/lib"
"github.com/labstack/echo/v4"
)

File diff suppressed because one or more lines are too long

View file

@ -6,8 +6,8 @@ import (
"io/fs"
"net/http"
contentfs "atri.dad/content"
"atri.dad/lib"
contentfs "goth.stack/content"
"goth.stack/lib"
chromahtml "github.com/alecthomas/chroma/v2/formatters/html"
"github.com/labstack/echo/v4"
"github.com/yuin/goldmark"

View file

@ -8,8 +8,8 @@ import (
"strings"
"time"
contentfs "atri.dad/content"
"atri.dad/lib"
contentfs "goth.stack/content"
"goth.stack/lib"
"github.com/labstack/echo/v4"
)

View file

@ -1,49 +0,0 @@
package pages
import (
"atri.dad/lib"
"github.com/labstack/echo/v4"
)
type ProjectProps struct {
Projects []lib.CardLink
}
func Projects(c echo.Context) error {
projects := []lib.CardLink{
{
Name: "Pollo",
Description: "A dead-simple real-time voting tool.",
Tags: []string{"golang", "htmx", "product"},
Href: "https://github.com/atridadl/pollo",
},
{
Name: "GOTH Stack",
Description: "🚀 A Web Application Template Powered by HTMX + Go + Tailwind 🚀",
Tags: []string{"golang", "htmx", "template"},
Href: "https://github.com/atridadl/goth.stack",
},
{
Name: "Himbot",
Description: "A discord bot written in Go. Loosly named after my username online (HimbothySwaggins).",
Tags: []string{"golang", "bot"},
Href: "https://github.com/atridadl/HimBot",
},
{
Name: "loadr",
Description: "A lightweight REST load testing tool with robust support for different verbs, token auth, and performance reports.",
Tags: []string{"golang", "cli"},
Href: "https://github.com/atridadl/loadr",
},
}
props := ProjectProps{
Projects: projects,
}
// 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

@ -1,24 +0,0 @@
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

@ -1,39 +0,0 @@
package pages
import (
"atri.dad/lib"
"github.com/labstack/echo/v4"
)
type TalkProps struct {
Talks []lib.CardLink
}
func Talks(c echo.Context) error {
talks := []lib.CardLink{
{
Name: "Hypermedia as the engine of application state - an Introduction",
Description: "A talk on building reactive websites using tools like HTMX instead of JSON + JS. Will be presented at the Dev Edmonton Fabruary 2024 JS/Ruby/Python Meetup",
Href: "/public/files/hypermedia_talk_atridad.pdf",
Tags: []string{"golang", "htmx", "ssr"},
Date: "February 01, 2024",
},
{
Name: "Introduction to Social Network Analysis (SNA)",
Description: "Understanding Relationships in Social Structures",
Href: "/public/files/Understanding_Relationships_in_Social_Structures.pdf",
Tags: []string{"graphs", "social", "lecture"},
Date: "October 08, 2024",
},
}
props := TalkProps{
Talks: talks,
}
// 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

@ -1,9 +1,9 @@
{{define "title"}}
Atridad Lahiji // Root
GOTH Stack // Root
{{end}}
{{define "headercontent"}}
Atridad Lahiji // Root
{{template "title" .}}
{{end}}
{{define "head"}}
@ -21,7 +21,7 @@ Atridad Lahiji // Root
</h2>
<span>
<h2 class="mb-2 text-xl text-white sm:text-[1.5rem]">Places I exist:</h2>
<h2 class="mb-2 text-xl text-white sm:text-[1.5rem]">Links:</h2>
<div class="flex flex-row flex-wrap items-center justify-center gap-4 text-center">
{{range .Socials}}
{{template "iconlinks" .}}
@ -30,7 +30,7 @@ Atridad Lahiji // Root
</span>
<span>
<h2 class="mb-2 text-xl text-white sm:text-[1.5rem]">Stuff I Use:</h2>
<h2 class="mb-2 text-xl text-white sm:text-[1.5rem]">Tech Stack:</h2>
<div class="flex flex-row flex-wrap items-center justify-center gap-4 text-center">
{{range .Tech}}

View file

@ -3,13 +3,7 @@
<a class="no-underline" href="/"> Home </a>
</li>
<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>
<a class="no-underline" href="/api/swagger/index.html"> API Documentation </a>
</li>
<li>
<a class="no-underline" href="/posts"> Posts </a>

View file

@ -1,9 +1,9 @@
{{define "title"}}
Atridad Lahiji // Post
GOTH Stack // Post
{{end}}
{{define "headercontent"}}
Atridad Lahiji // Post
{{template "title" .}}
{{end}}
{{define "head"}}

View file

@ -1,9 +1,9 @@
{{define "title"}}
Atridad Lahiji // Blog
GOTH Stack // Blog
{{end}}
{{define "headercontent"}}
Atridad Lahiji // Blog
{{template "title" .}}
{{end}}
{{define "head"}}

View file

@ -1,34 +0,0 @@
{{define "title"}}
Atridad Lahiji // Projects
{{end}}
{{define "headercontent"}}
Atridad Lahiji // Projects
{{end}}
{{define "head"}}
<link rel="stylesheet" href="/public/css/styles.css" />
{{end}}
{{define "main"}}
{{if .Projects}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
{{range .Projects}}
{{template "cardlinks" .}}
{{end}}
</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}}

View file

@ -1,9 +1,9 @@
{{define "title"}}
Atridad Lahiji // Publications
GOTH Stack // Publications
{{end}}
{{define "headercontent"}}
Atridad Lahiji // Publications
{{template "title" .}}
{{end}}
{{define "head"}}

View file

@ -1,34 +0,0 @@
{{define "title"}}
Atridad Lahiji // Talks
{{end}}
{{define "headercontent"}}
Atridad Lahiji // Talks
{{end}}
{{define "head"}}
<link rel="stylesheet" href="/public/css/styles.css" />
{{end}}
{{define "main"}}
{{if .Talks}}
<section class="flex flex-row flex-wrap gap-2 justify-center align-middle">
{{range .Talks}}
{{template "cardlinks" .}}
{{end}}
</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

@ -1,9 +1,9 @@
{{define "title"}}
Atridad Lahiji // Tools
GOTH Stack // Tools
{{end}}
{{define "headercontent"}}
Atridad Lahiji // Tools
{{template "title" .}}
{{end}}
{{define "head"}}

View file

@ -1,9 +1,9 @@
{{define "title"}}
Atridad Lahiji // Tools // Resizer
GOTH Stack // Tools // Resizer
{{end}}
{{define "headercontent"}}
Atridad Lahiji // Tools // Resizer
{{template "title" .}}
{{end}}
{{define "head"}}

View file

@ -1,7 +1,7 @@
{{define "title"}}Atridad Lahiji // Tools // SSE Demo{{end}}
{{define "title"}}GOTH Stack // Tools // SSE Demo{{end}}
{{define "headercontent"}}
Atridad Lahiji // Tools // SSE Demo
{{template "title" .}}
{{end}}
{{define "head"}}

View file

@ -1,7 +1,7 @@
package pages
import (
"atri.dad/lib"
"goth.stack/lib"
"github.com/labstack/echo/v4"
)

View file

@ -1,8 +1,8 @@
package pages
import (
"atri.dad/lib"
"github.com/labstack/echo/v4"
"goth.stack/lib"
)
type ResizeProps struct {
@ -27,7 +27,7 @@ func Resize(c echo.Context) error {
},
}
props := TalkProps{
props := ResizeProps{
Talks: talks,
}

View file

@ -1,7 +1,7 @@
package pages
import (
"atri.dad/lib"
"goth.stack/lib"
"github.com/labstack/echo/v4"
)