this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

✨ Style up the blog index, other stuff too

+58 -44
+6 -6
components/intro.templ
··· 39 39 40 40 templ Intro(overrides ...string) { 41 41 <section class={ introSection() }> 42 - <p class={ preH1() } i18n?={ len(overrides) == 0 }> 43 - if len(overrides) >= 1 { 44 - { overrides[0] } 42 + <p class={ preH1() } i18n?={ len(overrides) <= 1 }> 43 + if len(overrides) >= 2 { 44 + { overrides[1] } 45 45 } else { 46 46 Hi! I'm Ewen Le Bihan. 47 47 } 48 48 </p> 49 - <h1 class={ h1() } i18n?={ len(overrides) <= 1 }> 50 - if len(overrides) >= 2 { 51 - { overrides[1] } 49 + <h1 class={ h1() } i18n?={ len(overrides) == 0}> 50 + if len(overrides) >= 1 { 51 + { overrides[0] } 52 52 } else { 53 53 These are my creations. 54 54 }
+12 -6
components/resume.templ
··· 19 19 20 20 css cardFigure() { 21 21 font-size: 3em; 22 - display: flex; 23 - align-items: center; 22 + display: flex; 23 + align-items: center; 24 24 justify-content: center; 25 25 } 26 26 ··· 40 40 } 41 41 42 42 templ SkillCard(href string, figure int, logo string) { 43 - @shared.OnHover(skillCard(), shared.Declarations{ 44 - "box-shadow": "0 9px 12px 1px rgba(0, 0, 0, 0.14), 0 3px 16px 2px rgba(0, 0, 0, 0.12), 0 5px 6px -3px rgba(0, 0, 0, 0.2)", 45 - }) 46 - <a class={ skillCard() } href={ templ.URL(href) }> 43 + @Card(href) { 47 44 <div class={ cardFigure() }> 48 45 if logo != "" { 49 46 <img class={ skillLogo() } src={ shared.Asset(logo) }/> ··· 53 50 <p> 54 51 { children... } 55 52 </p> 53 + } 54 + } 55 + 56 + templ Card(href string) { 57 + @shared.OnHover(skillCard(), shared.Declarations{ 58 + "box-shadow": "0 9px 12px 1px rgba(0, 0, 0, 0.14), 0 3px 16px 2px rgba(0, 0, 0, 0.12), 0 5px 6px -3px rgba(0, 0, 0, 0.2)", 59 + }) 60 + <a class={ skillCard() } href={ templ.URL(href) }> 61 + { children... } 56 62 </a> 57 63 }
+1 -5
main.go
··· 118 118 119 119 handlePage("blog", pages.BlogIndex(blogEntries)) 120 120 for _, entry := range blogEntries { 121 - err := entry.GetPageviews("/blog") 122 - if err != nil { 123 - fmt.Printf("[!!] Could not get pageviews for blog entry %s: %s\n", "blog/"+entry.Slug, err) 124 - } 125 - 121 + entry.BlogRoot = "/blog" 126 122 handlePage("blog/"+entry.Slug, pages.BlogEntry(entry, db)) 127 123 } 128 124
+9 -11
pages/blog_entry.templ
··· 7 7 8 8 templ BlogEntry(entry shared.BlogEntry, db ortfodb.Database) { 9 9 @components.IntroWith(entry.Date.Format("2006-01-02"), entry.Title, false) { 10 - @components.ArrowLink("/about") { 11 - <i18n>Learn more about me</i18n> 12 - } 13 10 } 14 11 <main class={ "blog-entry", blogEntryMain() }> 15 12 @shared.HTML(ortfodb.HTMLString(entry.Content)) 16 - if entry.Pageviews > 1 { 17 - } 18 13 </main> 19 - if entry.Pageviews > 1 { 20 - <footer class={ entryFooter() }> 21 - <h2>Stats from <a href="https://stats.ewen.works/ewen.works">stats.ewen.works</a> </h2> 22 - { fmt.Sprintf("%d", entry.Pageviews) } views 23 - </footer> 24 - } 25 14 if len(entry.RelatedWorksSlugs) > 0 { 26 15 <h2 class={ centeredHeader() }>Related works</h2> 27 16 @components.GalleryPage(entry.RelatedWorks(db), "en", false) 28 17 } 18 + @components.Intro("", "whoami?") { 19 + @components.ArrowLink("/about") { 20 + <i18n>Learn more about me</i18n> 21 + } 22 + } 23 + <footer class={ entryFooter() }> 24 + <h2>Stats from <a href="https://stats.ewen.works/ewen.works">stats.ewen.works</a> </h2> 25 + { fmt.Sprintf("%d", entry.Pageviews()) } views 26 + </footer> 29 27 } 30 28 31 29 css centeredHeader() {
+20 -5
pages/blog_index.templ
··· 4 4 import "github.com/ewen-lbh/portfolio/components" 5 5 6 6 templ BlogIndex(entries []shared.BlogEntry) { 7 - @components.Intro() { 8 - <ul> 7 + @components.IntroWith("Hiya~", "Welcome to my blog index", true) 8 + <main class={ articlesList() }> 9 + <ul class={ components.SkillsList() }> 9 10 for _, entry := range entries { 10 11 <li> 11 - <a href={ templ.URL("/blog/" + entry.Slug) }>{ entry.Slug }</a> 12 + @components.Card("/blog/" + entry.Slug) { 13 + <h2>{ entry.Title }</h2> 14 + <p>{ entry.Date.Format("2006-01-02") }</p> 15 + } 16 + // <dt>{ entry.Date.Format("2006-01-02") }</dt> 17 + // <dd> 18 + // <a href={ templ.URL("/blog/" + entry.Slug) }>{ entry.Title }</a> 19 + // </dd> 12 20 </li> 13 21 } 14 22 </ul> 15 - } 23 + </main> 16 24 } 17 25 18 - 26 + css articlesList() { 27 + display: flex; 28 + flex-direction: column; 29 + justify-content: center; 30 + max-width: 800px; 31 + margin: 3rem auto; 32 + padding: 1rem; 33 + }
+4 -3
pages/layout.templ
··· 157 157 158 158 templ Navigation(links []NavigationLink) { 159 159 @shared.OnHover(navigationLink(), shared.Declarations{ 160 - "opacity": "1", 161 - "font-weight": "800", 162 - }) 160 + "opacity": "1", 161 + "font-weight": "800", 162 + }) 163 163 <style> 164 164 @media (max-width:600px) { 165 165 #nav-toggle { ··· 307 307 func RegularLayoutLinks(collections map[string]string, lang string, currentPath string) []NavigationLink { 308 308 links := []NavigationLink{ 309 309 {Text: "works", Link: "/", NeedsTranslation: true}, 310 + {Text: "blog", Link: "/blog", NeedsTranslation: true}, 310 311 } 311 312 312 313 for _, entry := range shared.SortedKeys(collections) {
+6 -8
shared/blog.go
··· 19 19 Slug string 20 20 Content string 21 21 OtherMetadata map[string]any `yaml:",inline"` 22 - Pageviews int 23 - RelatedWorksSlugs []string `yaml:"works"` 22 + RelatedWorksSlugs []string `yaml:"works"` 23 + BlogRoot string 24 24 } 25 25 26 26 func (e *BlogEntry) RelatedWorks(db ortfodb.Database) []ortfodb.AnalyzedWork { ··· 37 37 return works 38 38 } 39 39 40 - func (e *BlogEntry) GetPageviews(blogRoot string) error { 41 - views, err := getPageviewsFor(blogRoot + "/" + e.Slug) 40 + func (e *BlogEntry) Pageviews() int { 41 + views, err := getPageviewsFor(e.BlogRoot + "/" + e.Slug) 42 42 if err != nil { 43 - return err 43 + fmt.Printf("[!!] Failed to get pageviews for %s: %v\n", e.Slug, err) 44 44 } 45 - 46 - e.Pageviews = views 47 - return nil 45 + return views 48 46 } 49 47 50 48 func getPageviewsFor(path string) (int, error) {