This commit is contained in:
rawleyIfowler
2022-02-06 17:33:47 -06:00
commit 4389b07f39
16 changed files with 461 additions and 0 deletions

41
controllers/blog.go Normal file
View File

@@ -0,0 +1,41 @@
package controllers
/*
Copyright (C) 2022 Rawley Fowler
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.Rawley Fowler, 2022
*/
import (
"github.com/gin-gonic/gin"
"net/http"
"gitlab.com/rawleyifowler/site-rework/models"
)
func RegisterBlogGroup(r *gin.RouterGroup) {
r.GET("/", RenderBlogPage)
r.GET("/post/:url", RenderIndividualBlogPost)
}
func RenderBlogPage(c *gin.Context) {
}
func RenderIndividualBlogPost(c *gin.Context) {
}
func GetAllBlogPosts() {
}

5
go.mod Normal file
View File

@@ -0,0 +1,5 @@
module gitlab.com/rawleyifowler/site-rework
go 1.15
require github.com/gin-gonic/gin v1.7.7

49
go.sum Normal file
View File

@@ -0,0 +1,49 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.7.7 h1:3DoBmSbJbZAWqXJC3SLjAPfutPJJRN1U5pALB7EeTTs=
github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

33
main.go Normal file
View File

@@ -0,0 +1,33 @@
package main
/*
Copyright (C) 2022 Rawley Fowler
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.Rawley Fowler, 2022
*/
import (
"github.com/gin-gonic/gin"
"gitlab.com/rawleyifowler/site-rework/utils"
)
var router *gin.Engine
func main() {
router = gin.Default()
router.Static("/static", "./static")
router.LoadHTMLGlob("templates/*.tmpl")
utils.InitializeRoutes(router)
router.Run()
}

31
models/blog_post.go Normal file
View File

@@ -0,0 +1,31 @@
package models
/*
Copyright (C) 2022 Rawley Fowler
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.Rawley Fowler, 2022
*/
type BlogPost struct {
Url string `json:"url"`
Title string `json:"title"`
Date string `json:"date"`
Comments []Comment
}
// Load comments here
func (b *BlogPost) LoadComments() bool {
return false
}

24
models/comment.go Normal file
View File

@@ -0,0 +1,24 @@
package models
/*
Copyright (C) 2022 Rawley Fowler
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.Rawley Fowler, 2022
*/
type Comment struct {
Date string `json:"date"`
Author string `json:"author"`
Content string `json:"content"`
}

BIN
static/Resume.pdf Normal file

Binary file not shown.

1
static/bg.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.0 KiB

145
static/index.css Normal file
View File

@@ -0,0 +1,145 @@
/*
Copyright (C) 2022 Rawley Fowler
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.Rawley Fowler, 2022
*/
body {
color: #242124;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
-webkit-font-smoothing: antialias;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
background-image: url('/static/bg.svg');
background-repeat: no-repeat;
background-size: cover;
font-size: calc(12px + 0.33vw);
max-width: 100vw;
min-height: 100vh;
margin-left: 3vw;
margin-right: 3vw;
}
h1 {
font-size: 2em;
font-weight: 800;
margin-bottom: 0;
margin-top: 12px;
}
h2 {
font-size: 1.3em;
font-weight: 700;
margin-bottom: 0;
}
h3 {
font-size: 1.2em;
font-weight: 600;
margin-bottom: 0;
}
p {
font-size: 1em;
font-weight: 500;
line-height: 1.4;
max-width: 33em;
margin-right: 12px;
}
a {
text-decoration: none;
color: #242124;
position: relative;
transition: 100ms linear;
}
a:hover {
color: rgba(72,61,139, 0.3);
}
a::after {
content: '';
position: absolute;
z-index: -1;
top: 83%;
left: -0.1em;
right: -0.1em;
bottom: 0;
transition: 200ms cubic-bezier(0, 0.8, 0.13, 1);
background-color: rgba(72,61,139, 0.3);
}
a::after:hover {
background-color: rgba(129, 66, 180, 0.3);
top: 0%;
}
.header {
display: flex;
flex-direction: row;
justify-content: space-between;
}
.nav-bar {
display: flex;
flex-direction: row;
font-size: 1.1em;
margin-top: calc(12px + 1vh);
}
.nav-item {
display: block;
margin-left: 12px;
margin-right: 12px;
font-weight: 800;
}
.content-wrapper {
margin: 12px;
}
.footer-text {
font-size: 0.8em;
}
.post-record {
background-color: rgba(233, 233, 233, 0.6);
padding-left: 12px;
padding-right: 12px;
width: 200px + 2vw;
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-top: 9px;
}
.skill-keywords {
overflow: wrap;
font-size: 0.9em;
}
.skill-keywords > i::before {
content: " '";
}
.skill-keywords > i::after {
content: "' ";
}
@media only screen and (max-width: 508px) {
.header {
flex-direction: column;
justify-content: center;
}
}

9
templates/footer.tmpl Normal file
View File

@@ -0,0 +1,9 @@
<!--footer.html-->
<div class="footer">
<p class="footer-text">This site is powered by:</p>
<a href="https://www.openbsd.org/">
<img src="https://www.openbsd.org/images/banner1.gif" alt="Powered by OpenBSD!" width="150px" height="50px"/>
</a>
</div>
</body>
</html>

13
templates/header.tmpl Normal file
View File

@@ -0,0 +1,13 @@
<!--header.html-->
<!DOCTYPE html>
<html>
<head>
<meta lang="en">
<meta charset="UTF-8">
<meta name="keywords" content="blog resume rawley-fowler rawley fowler Rawley Fowler portfolio">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/static/index.css" rel="stylesheet" type="text/css">
<title>rawley.xyz</title>
</head>
<body>
{{ template "nav.tmpl" . }}

12
templates/index.tmpl Normal file
View File

@@ -0,0 +1,12 @@
{{ template "header.tmpl" . }}
<h2>My name is Rawley!</h2>
<p>
I am an independent full-stack developer from Canada. Currently pursuing a degree in Computer Science, with hopes of participating in a graduate program.
</p>
<p>
I am a GNU/Linux and OpenBSD enthusiast. I am active in both the Debian and Void GNU/Linux communities. My favourite programming languages are Go and Clojure. You can check out my work on <a href="https://gitlab.com/rawleyIfowler">GitLab</a>. I am currently working on an open-source community based blogging network called <a href="https://gitlab.com/xrn">xrn</a>.
</p>
<p>
When I'm not programming, I'm either reading, cooking, playing table-top games, or walking my dog.
</p>
{{ template "footer.tmpl" . }}

20
templates/nav.tmpl Normal file
View File

@@ -0,0 +1,20 @@
<!--nav.html-->
<div class="header">
<h1 class="header-title">
<a href="/">Rawley.xyz</a>
</h1>
<div class="nav-bar">
<div>
<a class="nav-item" href="/blog">blog</a>
</div>
<div>
<a class="nav-item" href="/resume">resume</a>
</div>
<div>
<a class="nav-item" href="/contact">contact</a>
</div>
<div>
<a class="nav-item" href="https://gitlab.com/rawleyIfowler">software</a>
</div>
</div>
</div>

7
templates/not_found.tmpl Normal file
View File

@@ -0,0 +1,7 @@
<!--not_found.html-->
{{ template "header.tmpl" . }}
<h2>404 Not Found :(</h2>
<p>
Click <a href="/">here</a> to return home.
</p>
{{ template "footer.tmpl" . }}

30
templates/resume.tmpl Normal file
View File

@@ -0,0 +1,30 @@
<!--resume.tmpl-->
{{ template "header.tmpl" . }}
<h2>My resume</h2>
<p>
<a href="/static/Resume.pdf">View my resume (pdf).</a>
</p>
<p class="skill-keywords">
<i>GNU/Linux</i>
<i>Debian</i>
<i>OpenBSD</i>
<i>Go</i>
<i>Clojure</i>
<i>Git</i>
<i>Gentoo</i>
<i>Java</i>
<i>NGiNX</i>
<i>Vim</i>
<i>C/C++</i>
<i>NetBSD</i>
<i>JavaScript</i>
<i>HTML</i>
<i>CSS</i>
<i>Unix</i>
<i>Vue</i>
<i>MariaDB</i>
<i>Korn Shell</i>
<i>Bash</i>
<i>Lua</i>
</p>
{{ template "footer.tmpl" . }}

41
utils/routes.go Normal file
View File

@@ -0,0 +1,41 @@
package utils
/*
Copyright (C) 2022 Rawley Fowler
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.Rawley Fowler, 2022
*/
import (
"github.com/gin-gonic/gin"
"net/http"
)
// Initializes all routes from the controller package
func InitializeRoutes(router *gin.Engine) {
router.NoRoute(ServePage("not_found.tmpl"))
router.GET("/", ServePage("index.tmpl"))
router.GET("/resume", ServePage("resume.tmpl"))
}
// Returns a handler function to serve a page based on the template that is inputted
func ServePage(temp string) gin.HandlerFunc {
return func(c *gin.Context) {
c.HTML(
http.StatusOK,
temp,
gin.H{},
)
}
}