Skip to content

Commit

Permalink
Add styles and g analytics (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
NickFoden authored Jan 4, 2025
1 parent d5408ca commit 0d7c9fe
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 15 deletions.
7 changes: 4 additions & 3 deletions internal/content/posts.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (

var posts = []models.Post{
{Title: "New Web Log Alert",
Content: "",
CreatedAt: time.Date(2025, 1, 3, 0, 0, 0, 0, time.UTC),
Slug: "1"},
Content: "",
ContentPreview: "A \"simple\" web log built with Go and html + htmx.",
CreatedAt: time.Date(2025, 1, 3, 0, 0, 0, 0, time.UTC),
Slug: "1"},
}

func GetAllPosts() []models.Post {
Expand Down
15 changes: 13 additions & 2 deletions internal/content/posts/1.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
<p>Messing around with go and HTMX and html templates to make a simple blog in a new way.</p>
<p class="font_roboto-condensed post_p">Messing around with go and HTMX and html templates to make a simple blog in a
way that
is new to me. I've gone through a few iterations of blog approaches/sites and maybe this is the one that will stick
¯\_(ツ)_/¯
</p>
<p class="font_roboto-condensed post_p">So far this post / content files are html file(s), I know markdown seems like a
more popular option for dev blogs etc, but I kinda like the idea of writing vanilla html files for content here,
especially when llm assisted for styling or formatting.</p>

<p>More styles and content to come as I firm up the approach here. </p>
<p class="font_roboto-condensed post_p">I'm betting on leveraging more classic web such as html css files etc, and
that we will continue to see less tooling/abstractions for dev experience since devs are now llm assisted. The
fastest sites out there are just cached css and html right, why jump through all the hoops when you are now able to
be assisted for the creation of the styles and can generate the styles instantly and then spot check. This post
written out and css file generated/styled by hand quickly as you can tell, but I mean for the future !</p>
9 changes: 5 additions & 4 deletions internal/models/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package models
import "time"

type Post struct {
Title string
Content string
Slug string
CreatedAt time.Time
Title string
Content string
ContentPreview string
Slug string
CreatedAt time.Time
}
23 changes: 21 additions & 2 deletions internal/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,36 @@
<head>
<title>{{ .Title }}</title>
<link rel="stylesheet" href="/static/css/style.css" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@0,100..900;1,100..900&family=Sixtyfour&display=swap"
rel="stylesheet"
/>
<script src="https://unpkg.com/[email protected]"></script>
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-ETK9JGW8YR"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());

gtag("config", "G-ETK9JGW8YR");
</script>
</head>
<body>
<header>
<a href="/">
<h1>Nick Foden</h1>
<h1 class="font_sixtyfour">Web Log</h1>
</a>
</header>
<main>{{block "content" .}}{{end}}</main>
<footer>
<p>
<p class="font_sixtyfour">
&copy;
<span
hx-get="/get_current_year"
Expand Down
16 changes: 14 additions & 2 deletions internal/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
{{template "base.html" .}} {{ define "content" }}
<ul>
<ul class="index_posts_ul">
{{ range .Posts }}
<li><a href="/posts/{{ .Slug }}">{{ .Title }}</a></li>
<li>
<div class="row">
<a class="font_roboto-condensed" href="/posts/{{ .Slug }}"
>{{ .Title }}</a
>
<p class="font_roboto-condensed index_post_date">
({{.CreatedAt.Format "2006-01-02"}})
</p>
</div>
<p class="font_roboto-condensed index_post_content_preview">
{{ .ContentPreview }}
</p>
</li>
{{ end }}
</ul>
{{ end }}
4 changes: 2 additions & 2 deletions internal/templates/post.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{ template "base.html" . }} {{define "content"}}
<div class="post">
<article>
<h2>{{.Post.Title}}</h2>
<p>{{.Post.CreatedAt.Format "2006-01-02"}}</p>
<h2 class="font_roboto-condensed">{{.Post.Title}}</h2>
<p class="font_roboto-condensed">{{.Post.CreatedAt.Format "2006-01-02"}}</p>
{{.Content}}
</article>
</div>
Expand Down
61 changes: 61 additions & 0 deletions static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ a {

article {
margin: 24px;
max-width: 768px;
}

body {
Expand All @@ -15,10 +16,70 @@ footer {
text-align: center;
}

footer p {
font-size: 12px;
}

header {
margin: 0 auto;
max-width: 1024px;
}

h1 {
font-size: 18px;
}

main {
margin: 0 auto;
max-width: 1024px;
min-height: 80vh;
overflow-x: hidden;
}

.font_sixtyfour {
font-family: "Sixtyfour", serif;
font-optical-sizing: auto;
font-style: normal;
font-variation-settings: "BLED" 0, "SCAN" 0;
font-weight: 400;
}

.font_roboto-condensed {
font-family: "Roboto Condensed", serif;
font-optical-sizing: auto;
font-style: normal;
font-weight: 400;
}

.index_post_content_preview {
font-size: 14px;
margin: 8px 0 0 0;
}

.index_post_date {
font-size: 14px;
margin: 0 0 0 8px;
}

.index_posts_ul {
margin: 24px 0 0 0;
}

.margin_zero {
margin: 0 0 0 0;
}

.post {
margin: 48px 0 0 0;
}

.post_p {
font-size: 20px;
margin: 8px 0 0 0;
}

.row {
display: flex;
align-items: center;
flex-direction: row;
}

0 comments on commit 0d7c9fe

Please sign in to comment.