this repo has no description
1
fork

Configure Feed

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

✨ Link to related blog entries from work pages

+27 -1
+1
main.go
··· 106 106 shared.TagsOf(tags, work.Metadata), 107 107 shared.TechsOf(technologies, work.Metadata), 108 108 collections.ThatIncludeWork(work, shared.Keys(db.Works()), tags, technologies), 109 + blogEntries, 109 110 translations.language, 110 111 )) 111 112
+16 -1
pages/work.templ
··· 398 398 return false 399 399 } 400 400 401 - templ Work(work ortfodb.Work, tags []shared.Tag, techs []shared.Technology, collections []shared.Collection, lang string) { 401 + templ Work(work ortfodb.Work, tags []shared.Tag, techs []shared.Technology, collections []shared.Collection, blogEntries []shared.BlogEntry, lang string) { 402 402 @withIntro(work, lang) { 403 403 @shared.OnHover(tagLink(), shared.Declarations{ 404 404 "opacity": "1", ··· 484 484 // </div> 485 485 } 486 486 </li> 487 + } 488 + </ul> 489 + </section> 490 + } 491 + if len(shared.RelatedBlogEntries(work, blogEntries)) > 0 { 492 + <section class={ standardWorkSection() }> 493 + <h2 i18n>Related blog entries</h2> 494 + <ul class={ components.SkillsList() }> 495 + for _, entry := range shared.RelatedBlogEntries(work, blogEntries) { 496 + <li> 497 + @components.Card("/blog/" + entry.Slug) { 498 + <h2>{ entry.Title }</h2> 499 + <p>{ entry.Date.Format("2006-01-02") }</p> 500 + } 501 + </li> 487 502 } 488 503 </ul> 489 504 </section>
+10
shared/blog.go
··· 23 23 BlogRoot string 24 24 } 25 25 26 + func RelatedBlogEntries(w ortfodb.Work, allEntries []BlogEntry) []BlogEntry { 27 + entries := make([]BlogEntry, 0) 28 + for _, entry := range allEntries { 29 + if len(entry.RelatedWorks(ortfodb.Database{w.ID: w})) > 0 { 30 + entries = append(entries, entry) 31 + } 32 + } 33 + return entries 34 + } 35 + 26 36 func (e *BlogEntry) RelatedWorks(db ortfodb.Database) []ortfodb.Work { 27 37 var works []ortfodb.Work 28 38 for _, slug := range e.RelatedWorksSlugs {