@@ -113,11 +113,37 @@ class StaticSiteLoader(val root: File, val args: Scaladoc.Args)(using StaticSite
113
113
StaticSiteRoot (withBlog, mappings)
114
114
}
115
115
116
+ var hiddenBlog = false
117
+
118
+ def readYml : (Option [Boolean ], Option [Boolean ], Option [Boolean ], String ) =
119
+ val ymlPath = root.toPath.resolve(" blog.yml" )
120
+ if (Files .exists(ymlPath)) then
121
+ val yamlContent = Source .fromFile(ymlPath.toString).getLines().mkString(" \n " )
122
+ val hidden = if (yamlContent.contains(" hidden: true" )) Some (true ) else None
123
+ val input = if (yamlContent.contains(" input:" )) Some (true ) else None
124
+ val output = if (yamlContent.contains(" output:" )) Some (true ) else None
125
+ (hidden, input, output, yamlContent)
126
+ else
127
+ (None , None , None , " " )
128
+
116
129
def loadBlog (): Option [LoadedTemplate ] = {
130
+ val (hidden, input, output, yamlContent) = readYml
131
+ val lines = yamlContent.split(" \n " )
132
+ val rootPath = input.collect {
133
+ case true =>
134
+ lines.collectFirst { case line if line.contains(" input:" ) => line.replaceFirst(" input:" , " " ).trim }
135
+ .map(ctx.resolveNewBlogPath)
136
+ .getOrElse(ctx.blogPath)
137
+ }.getOrElse(ctx.blogPath)
138
+ val defaultDirectory = output.collect {
139
+ case true =>
140
+ lines
141
+ .collectFirst { case line if line.contains(" output:" ) => line.replaceFirst(" output:" , " " ).trim }
142
+ .getOrElse(" blog" )
143
+ }.getOrElse(" blog" )
144
+ hidden.collect { case true => hiddenBlog = true }
117
145
type Date = (String , String , String )
118
- val rootPath = ctx.blogPath
119
- val defaultDirectory = " blog"
120
- if (! Files .exists(rootPath)) None
146
+ if (! Files .exists(rootPath) || hiddenBlog) None
121
147
else {
122
148
val indexPageOpt = Seq (
123
149
rootPath.resolve(" index.md" ),
0 commit comments