Layout day. I got the devlog grid working and wired the nested routes end to end.

Work done

  • add a ProjectSubPost type
  • folder-walking loader with draft and duplicate-slug checks
  • /projects/{slug}/{post} route
  • 301 redirect for the legacy /project/{slug}
  • devlog grid with a featured first card

Search updates

Devlogs now show up in search with the right nested URL. I added a ParentSlug field to SearchDoc, so docURL can build /projects/{parent}/{slug} when it has one.

Go
func docURL(doc content.SearchDoc) string {
    if doc.Type == "projects" {
        if doc.ParentSlug != "" {
            return "/projects/" + doc.ParentSlug + "/" + doc.Slug
        }
        return "/projects/" + doc.Slug
    }
    return "/post/" + doc.Slug
}

Update, July 12

The first grid picked its spans from the number of devlogs in a project, so the layout reshuffled every time a project gained a post. I replaced it with fixed columns: one on phones, two from 640px, three from 900px, and only the first card spans two columns and two rows.

CSS
@media (min-width: 900px) {
  .project-subposts-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: minmax(9rem, auto);
  }

  .project-subpost-card:first-child {
    grid-column: span 2;
    grid-row: span 2;
  }
}

The route reorganization worried me most. It landed without breaking the existing tag and post routes.