fix: filter draft (published:false) out of subject index, ribbon dropdowns, and Topics boxes too
This commit is contained in:
@@ -158,6 +158,15 @@ func (c *Content) loadSubject(slug string) (*Subject, error) {
|
|||||||
if err := c.loadFilesUnder(dir, &s.Articles); err != nil {
|
if err := c.loadFilesUnder(dir, &s.Articles); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
// drafts (published:false) are not part of the subject — this hides them from
|
||||||
|
// the subject index, ribbon dropdowns, and Topics boxes, not just the article route.
|
||||||
|
var pub []*Article
|
||||||
|
for _, a := range s.Articles {
|
||||||
|
if a.FM.Published {
|
||||||
|
pub = append(pub, a)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s.Articles = pub
|
||||||
// newest first within a subject (drives Topics boxes + ribbon dropdowns)
|
// newest first within a subject (drives Topics boxes + ribbon dropdowns)
|
||||||
sortArticles(s.Articles)
|
sortArticles(s.Articles)
|
||||||
for _, a := range s.Articles {
|
for _, a := range s.Articles {
|
||||||
|
|||||||
Reference in New Issue
Block a user