diff --git a/blog/blog-feature-art-gallery-2019-11-01.markdown b/blog/blog-feature-art-gallery-2019-11-01.markdown new file mode 100644 index 0000000..565775d --- /dev/null +++ b/blog/blog-feature-art-gallery-2019-11-01.markdown @@ -0,0 +1,21 @@ +--- +title: "Blog Feature: Art Gallery" +date: 2019-11-01 +tags: + - art + - announce + - 100th-post +--- + +# Blog Feature: Art Gallery + +I have just implemented support for my portfolio site to also function as an art +gallery. See all of my posted art [here](/gallery). + +I have been trying to get better at art for a while and I feel I'm at the level +where I feel comfortable putting it on my portfolio. Let's see how far this +rabbit hole goes. + +--- + +Also this is my 100th post! Yay! diff --git a/cmd/site/html.go b/cmd/site/html.go index 558dc71..912ad77 100644 --- a/cmd/site/html.go +++ b/cmd/site/html.go @@ -98,6 +98,59 @@ func (s *Site) showSeries(w http.ResponseWriter, r *http.Request) { }).ServeHTTP(w, r) } +func (s *Site) showGallery(w http.ResponseWriter, r *http.Request) { + if r.RequestURI == "/gallery/" { + http.Redirect(w, r, "/gallery", http.StatusSeeOther) + return + } + + cmp := r.URL.Path[1:] + var p blog.Post + var found bool + for _, pst := range s.Gallery { + if pst.Link == cmp { + p = pst + found = true + } + } + + if !found { + w.WriteHeader(http.StatusNotFound) + s.renderTemplatePage("error.html", "no such post found: "+r.RequestURI).ServeHTTP(w, r) + return + } + + var tags string + if len(p.Tags) != 0 { + for _, t := range p.Tags { + tags = tags + " #" + strings.ReplaceAll(t, "-", "") + } + } + + h := s.renderTemplatePage("gallerypost.html", struct { + Title string + Link string + BodyHTML template.HTML + Date string + Tags string + Image string + }{ + Title: p.Title, + Link: p.Link, + BodyHTML: p.BodyHTML, + Date: internal.IOS13Detri(p.Date), + Tags: tags, + Image: p.ImageURL, + }) + + if h == nil { + panic("how did we get here?") + } + + h.ServeHTTP(w, r) + postView.With(prometheus.Labels{"base": filepath.Base(p.Link)}).Inc() +} + func (s *Site) showTalk(w http.ResponseWriter, r *http.Request) { if r.RequestURI == "/talks/" { http.Redirect(w, r, "/talks", http.StatusSeeOther) diff --git a/cmd/site/main.go b/cmd/site/main.go index 391b56b..eaefb5d 100644 --- a/cmd/site/main.go +++ b/cmd/site/main.go @@ -55,10 +55,11 @@ func main() { // Site is the parent object for https://christine.website's backend. type Site struct { - Posts blog.Posts - Talks blog.Posts - Resume template.HTML - Series []string + Posts blog.Posts + Talks blog.Posts + Gallery blog.Posts + Resume template.HTML + Series []string rssFeed *feeds.Feed jsonFeed *jsonfeed.Feed @@ -82,7 +83,7 @@ func (s *Site) ServeHTTP(w http.ResponseWriter, r *http.Request) { middleware.RequestID(s.xffmw.Handler(ex.HTTPLog(s.mux))).ServeHTTP(w, r) } -var arbDate = time.Date(2019, time.September, 12, 0, 0, 0, 0, time.UTC) +var arbDate = time.Date(2019, time.November, 2, 0, 0, 0, 0, time.UTC) // Build creates a new Site instance or fails. func Build() (*Site, error) { @@ -157,9 +158,16 @@ func Build() (*Site, error) { } s.Talks = talks + gallery, err := blog.LoadPosts("./gallery", "gallery") + if err != nil { + return nil, err + } + s.Gallery = gallery + var everything blog.Posts everything = append(everything, posts...) everything = append(everything, talks...) + everything = append(everything, gallery...) sort.Sort(sort.Reverse(everything)) @@ -208,6 +216,7 @@ func Build() (*Site, error) { s.mux.Handle("/resume", middleware.Metrics("resume", s.renderTemplatePage("resume.html", s.Resume))) s.mux.Handle("/blog", middleware.Metrics("blog", s.renderTemplatePage("blogindex.html", s.Posts))) s.mux.Handle("/talks", middleware.Metrics("talks", s.renderTemplatePage("talkindex.html", s.Talks))) + s.mux.Handle("/gallery", middleware.Metrics("gallery", s.renderTemplatePage("galleryindex.html", s.Gallery))) s.mux.Handle("/contact", middleware.Metrics("contact", s.renderTemplatePage("contact.html", nil))) s.mux.Handle("/blog.rss", middleware.Metrics("blog.rss", http.HandlerFunc(s.createFeed))) s.mux.Handle("/blog.atom", middleware.Metrics("blog.atom", http.HandlerFunc(s.createAtom))) @@ -216,6 +225,7 @@ func Build() (*Site, error) { s.mux.Handle("/blog/series", http.HandlerFunc(s.listSeries)) s.mux.Handle("/blog/series/", http.HandlerFunc(s.showSeries)) s.mux.Handle("/talks/", middleware.Metrics("talks", http.HandlerFunc(s.showTalk))) + s.mux.Handle("/gallery/", middleware.Metrics("gallery", http.HandlerFunc(s.showGallery))) s.mux.Handle("/css/", http.FileServer(http.Dir("."))) s.mux.Handle("/static/", http.FileServer(http.Dir("."))) s.mux.HandleFunc("/sw.js", func(w http.ResponseWriter, r *http.Request) { diff --git a/gallery/bliss-2018-03-04.markdown b/gallery/bliss-2018-03-04.markdown new file mode 100644 index 0000000..7cace26 --- /dev/null +++ b/gallery/bliss-2018-03-04.markdown @@ -0,0 +1,10 @@ +--- +title: Bliss +date: 2018-03-04 +tags: + - raster +image: /static/art/Bliss.png +thumb: /static/art/Bliss_tn.jpg +--- + +Created with Procreate on iPadOS using an iPad Pro and an Apple Pencil. diff --git a/gallery/boat-2018-09-24.markdown b/gallery/boat-2018-09-24.markdown new file mode 100644 index 0000000..7fb37fd --- /dev/null +++ b/gallery/boat-2018-09-24.markdown @@ -0,0 +1,10 @@ +--- +title: Boat +date: 2018-09-24 +tags: + - raster +image: /static/art/Boat.png +thumb: /static/art/Boat_tn.jpg +--- + +Created with Procreate on iPadOS using an iPad Pro and an Apple Pencil. diff --git a/gallery/bokoblin-2018-11-01.markdown b/gallery/bokoblin-2018-11-01.markdown new file mode 100644 index 0000000..aa8a81c --- /dev/null +++ b/gallery/bokoblin-2018-11-01.markdown @@ -0,0 +1,11 @@ +--- +title: Bokoblin +date: 2018-11-01 +tags: + - botw + - raster +image: /static/art/Bokoblin.png +thumb: /static/art/Bokoblin_tn.jpg +--- + +Created with Procreate on iPadOS using an iPad Pro and an Apple Pencil. diff --git a/gallery/lifecycle-2019-05-23.markdown b/gallery/lifecycle-2019-05-23.markdown new file mode 100644 index 0000000..0e82e76 --- /dev/null +++ b/gallery/lifecycle-2019-05-23.markdown @@ -0,0 +1,12 @@ +--- +title: Lifecycle +date: 2019-05-23 +tags: + - raster +image: /static/art/Lifecycle.png +thumb: /static/art/Lifecycle_tn.jpg +--- + +Created with Procreate on iPadOS using an iPad Pro and an Apple Pencil. + +This is a tron lightcycle because the team I was on at the time was named Lifecycle. diff --git a/gallery/link-home-2018-09-01.markdown b/gallery/link-home-2018-09-01.markdown new file mode 100644 index 0000000..369b32d --- /dev/null +++ b/gallery/link-home-2018-09-01.markdown @@ -0,0 +1,11 @@ +--- +title: "Link's Home" +date: 2018-09-01 +tags: + - botw + - raster +image: /static/art/LinkHome2.png +thumb: /static/art/LinkHome2_tn.jpg +--- + +Created with Procreate on iPadOS using an iPad Pro and an Apple Pencil. diff --git a/gallery/link-sunset-2018-10-01.markdown b/gallery/link-sunset-2018-10-01.markdown new file mode 100644 index 0000000..74a2429 --- /dev/null +++ b/gallery/link-sunset-2018-10-01.markdown @@ -0,0 +1,11 @@ +--- +title: "Link's Sunset" +date: 2018-09-01 +tags: + - botw + - raster +image: /static/art/LinkSunset.png +thumb: /static/art/LinkSunset_tn.jpg +--- + +Created with Procreate on iPadOS using an iPad Pro and an Apple Pencil. diff --git a/gallery/orca-2019-11-01.markdown b/gallery/orca-2019-11-01.markdown new file mode 100644 index 0000000..5683bbd --- /dev/null +++ b/gallery/orca-2019-11-01.markdown @@ -0,0 +1,14 @@ +--- +title: Orca +date: 2019-11-01 +tags: + - furry + - orca + - vector +image: /static/art/Orca.png +thumb: /static/art/Orca_tn.jpg +--- + +# Orca + +Created with Affinity Designer on iPadOS using an iPad Pro and an Apple Pencil. diff --git a/internal/blog/blog.go b/internal/blog/blog.go index 7d4f93c..b27cce5 100644 --- a/internal/blog/blog.go +++ b/internal/blog/blog.go @@ -23,6 +23,8 @@ type Post struct { Series string `json:"series"` Tags []string `json:"tags"` SlidesLink string `json:"slides_link"` + ImageURL string `json:"image_url"` + ThumbURL string `json:"thumb_url"` Date time.Time DateString string `json:"date"` } @@ -65,6 +67,8 @@ func LoadPosts(path string, prepend string) (Posts, error) { Series string Tags []string SlidesLink string `yaml:"slides_link"` + Image string + Thumb string } var result Posts @@ -115,6 +119,8 @@ func LoadPosts(path string, prepend string) (Posts, error) { SlidesLink: fm.SlidesLink, Series: fm.Series, Tags: fm.Tags, + ImageURL: fm.Image, + ThumbURL: fm.Thumb, } result = append(result, p) diff --git a/internal/blog/blog_test.go b/internal/blog/blog_test.go index 8a446cd..4074636 100644 --- a/internal/blog/blog_test.go +++ b/internal/blog/blog_test.go @@ -29,6 +29,24 @@ func TestLoadTalks(t *testing.T) { } } +func TestLoadGallery(t *testing.T) { + gallery, err := LoadPosts("../../gallery", "gallery") + if err != nil { + t.Fatal(err) + } + + for _, art := range gallery { + t.Run(art.Link, art.test) + if art.ImageURL == "" { + t.Errorf("art %s (%s) doesn't have an image link", art.Title, art.DateString) + } + if art.ThumbURL == "" { + t.Errorf("art %s (%s) doesn't have a thumbnail link", art.Title, art.DateString) + } + + } +} + func (p Post) test(t *testing.T) { if p.Title == "" { t.Error("no post title") diff --git a/static/art/Bliss.png b/static/art/Bliss.png new file mode 100644 index 0000000..6b4ba8f Binary files /dev/null and b/static/art/Bliss.png differ diff --git a/static/art/Bliss_tn.jpg b/static/art/Bliss_tn.jpg new file mode 100644 index 0000000..9f1ab24 Binary files /dev/null and b/static/art/Bliss_tn.jpg differ diff --git a/static/art/Boat.png b/static/art/Boat.png new file mode 100644 index 0000000..840acd9 Binary files /dev/null and b/static/art/Boat.png differ diff --git a/static/art/Boat_tn.jpg b/static/art/Boat_tn.jpg new file mode 100644 index 0000000..cdd0df2 Binary files /dev/null and b/static/art/Boat_tn.jpg differ diff --git a/static/art/Bokoblin.png b/static/art/Bokoblin.png new file mode 100644 index 0000000..b7dd647 Binary files /dev/null and b/static/art/Bokoblin.png differ diff --git a/static/art/Bokoblin_tn.jpg b/static/art/Bokoblin_tn.jpg new file mode 100644 index 0000000..88598cd Binary files /dev/null and b/static/art/Bokoblin_tn.jpg differ diff --git a/static/art/Lifecycle.png b/static/art/Lifecycle.png new file mode 100644 index 0000000..fb0c199 Binary files /dev/null and b/static/art/Lifecycle.png differ diff --git a/static/art/Lifecycle_tn.jpg b/static/art/Lifecycle_tn.jpg new file mode 100644 index 0000000..f363aaf Binary files /dev/null and b/static/art/Lifecycle_tn.jpg differ diff --git a/static/art/LinkHome2.png b/static/art/LinkHome2.png new file mode 100644 index 0000000..0a997f6 Binary files /dev/null and b/static/art/LinkHome2.png differ diff --git a/static/art/LinkHome2_tn.jpg b/static/art/LinkHome2_tn.jpg new file mode 100644 index 0000000..dd0c488 Binary files /dev/null and b/static/art/LinkHome2_tn.jpg differ diff --git a/static/art/LinkSunset.png b/static/art/LinkSunset.png new file mode 100644 index 0000000..d1ad427 Binary files /dev/null and b/static/art/LinkSunset.png differ diff --git a/static/art/LinkSunset_tn.jpg b/static/art/LinkSunset_tn.jpg new file mode 100644 index 0000000..7aeee8f Binary files /dev/null and b/static/art/LinkSunset_tn.jpg differ diff --git a/static/art/Orca.png b/static/art/Orca.png new file mode 100644 index 0000000..a6411a7 Binary files /dev/null and b/static/art/Orca.png differ diff --git a/static/art/Orca_tn.jpg b/static/art/Orca_tn.jpg new file mode 100644 index 0000000..80dde37 Binary files /dev/null and b/static/art/Orca_tn.jpg differ diff --git a/static/js/sw.js b/static/js/sw.js index 62722a6..0fa1e3e 100755 --- a/static/js/sw.js +++ b/static/js/sw.js @@ -5,13 +5,13 @@ self.addEventListener('install', function(event) { event.waitUntil(preLoad()); }); -const cacheName = "cache-2019-10-15"; +const cacheName = "cache-2019-11-01"; var preLoad = function(){ console.log('[PWA Builder] Install Event processing'); return caches.open(cacheName).then(function(cache) { console.log('[PWA Builder] Cached index and offline page during Install'); - return cache.addAll(['/blog/', '/blog', '/', '/contact', '/resume', '/talks']); + return cache.addAll(['/blog/', '/blog', '/', '/contact', '/resume', '/talks', '/gallery']); }); }; diff --git a/templates/base.html b/templates/base.html index 3fdc591..f4d0a46 100644 --- a/templates/base.html +++ b/templates/base.html @@ -59,7 +59,7 @@ {{ template "scripts" . }}
-

Christine Dodrill - Blog - Contact - Resume - Talks | GraphViz - When Then Zen

+

Christine Dodrill - Blog - Contact - Gallery - Resume - Talks | GraphViz - When Then Zen

diff --git a/templates/galleryindex.html b/templates/galleryindex.html new file mode 100644 index 0000000..e3c1f33 --- /dev/null +++ b/templates/galleryindex.html @@ -0,0 +1,25 @@ +{{ define "title" }} +Gallery - Christine Dodrill +{{ end }} + +{{ define "content" }} +

Gallery

+ +

Here are links to all of the art I have done in the last few years.

+ +

If you have a compatible reader, be sure to check out my RSS Feed for automatic updates. Also check out the JSONFeed.

+ +

+

+ {{ range . }} +
+
{{ .Title }}
+
+

Posted on {{ .DateString }}

+
+
+ {{ end }} +
+

+ +{{ end }} diff --git a/templates/gallerypost.html b/templates/gallerypost.html new file mode 100644 index 0000000..f4c93b8 --- /dev/null +++ b/templates/gallerypost.html @@ -0,0 +1,116 @@ +{{ define "title" }} +{{ .Title }} - Christine Dodrill + + + + + + + + + + + + + + + + + + + +{{ end }} + +{{ define "content" }} + +

{{ .Title }}

+ +{{ .BodyHTML }} + +
+ +
+ +
+ + + + +

This artwork was posted on {{ .Date }}.

+ +{{ if ne .Tags "" }} +

Tags:{{.Tags}}

+{{ end }} + + + +{{ end }}