feat: add sb front matter
This commit is contained in:
+12
-3
@@ -427,11 +427,20 @@ func indexProse(sugar *zap.SugaredLogger, tsClient *typesense.Client, mongoDB *r
|
||||
content = joinParagraphs(strs)
|
||||
}
|
||||
|
||||
// Build URL: KB uses /books/kb/{volume}/{slug}, others use /books/{book}/{slug}
|
||||
// Build URL: KB uses /books/kb/{volume}/{slug}; chapter summaries map
|
||||
// their "<lila>-<n>" slug to the chapter landing page; others use
|
||||
// /books/{book}/{slug}.
|
||||
var proseURL string
|
||||
if book == "kb" {
|
||||
switch {
|
||||
case book == "kb":
|
||||
proseURL = fmt.Sprintf("/books/kb/%d/%s", volume, slug)
|
||||
} else {
|
||||
case docType == "chapter-summary":
|
||||
if parts := strings.SplitN(slug, "-", 2); len(parts) == 2 {
|
||||
proseURL = fmt.Sprintf("/books/%s/%s/%s", book, parts[0], parts[1])
|
||||
} else {
|
||||
proseURL = fmt.Sprintf("/books/%s/%s", book, slug)
|
||||
}
|
||||
default:
|
||||
proseURL = fmt.Sprintf("/books/%s/%s", book, slug)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user