Skip to content

Commit

Permalink
sites/www.toby.codes: add work page
Browse files Browse the repository at this point in the history
placeholder

Signed-off-by: toby lorne <toby@toby.codes>
  • Loading branch information
tlwr committed Oct 19, 2024
1 parent 2375d53 commit bd80359
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sites/www.toby.codes/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ func main() {
_ = renderer.HTML(w, http.StatusOK, "post", rendered)
})

mux.HandleFunc("/work", func(w http.ResponseWriter, req *http.Request) {
_ = renderer.HTML(w, http.StatusOK, "work", nil)
})

mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
if req.URL.Path != "" && req.URL.Path != "/" {
_ = renderer.HTML(w, http.StatusNotFound, "404", nil)
Expand Down
9 changes: 9 additions & 0 deletions sites/www.toby.codes/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ var _ = Describe("Server", Ordered, func() {
})
})

Describe("/work", func() {
It("should return something", func() {
err, code, body := GetPage("/work")
Expect(err).NotTo(HaveOccurred())
Expect(code).To(Equal(200))
Expect(body).To(ContainSubstring(`Work with me`))
})
})

Describe("/posts", func() {
Context("when listing all posts", func() {
It("should list posts", func() {
Expand Down
1 change: 1 addition & 0 deletions sites/www.toby.codes/templates/layout.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<nav>
<a href="/">About</a>
<a href="/posts">Posts</a>
<a href="/work">Work</a>
</nav>
</header>
</div>
Expand Down
7 changes: 7 additions & 0 deletions sites/www.toby.codes/templates/work.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<main role="main" class="homepage">
<h2>Work</h2>
<p>
Work with me on individual projects/solutions.
<i>Details coming soon</i>
</p>
</main>

0 comments on commit bd80359

Please # to comment.