pico

created pr with pico/142.1 on 2026-10-01T13:33:27Z · by c8ef7d19
added pico/142.2 on 2026-10-01T13:39:31Z · by c8ef7d19
1: 18a25e7 ! 1: 1e9cddc style(prose): minimal design ethos
-: ------- > 2: 0967882 chore(prose): remove with_styles and layout front-matter fields
cmds
checkout latest patchset:
ssh pr.pico.sh pull pico:142 | git am -3
checkout specific patchset revision:
ssh pr.pico.sh pull pico:142 [rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pico:142
add comment to patch request:
ssh pr.pico.sh comment pico:142 "lgtm!"
+33 -46 pkg/apps/prose/api.go #
......@@ -41,18 +41,17 @@ type PostItemData struct {
4141 }
4242
4343 type BlogPageData struct {
44- Site shared.SitePageData
45- PageTitle string
46- URL template.URL
47- RSSURL template.URL
48- Username string
49- Readme *ReadmeTxt
50- Header *HeaderTxt
51- Posts []PostItemData
52- HasCSS bool
53- WithStyles bool
54- CssURL template.URL
55- HasFilter bool
44+ Site shared.SitePageData
45+ PageTitle string
46+ URL template.URL
47+ RSSURL template.URL
48+ Username string
49+ Readme *ReadmeTxt
50+ Header *HeaderTxt
51+ Posts []PostItemData
52+ HasCSS bool
53+ CssURL template.URL
54+ HasFilter bool
5655 }
5756
5857 type ReadPageData struct {
......@@ -78,7 +77,6 @@ type PostPageData struct {
7877 PublishAtISO string
7978 PublishAt string
8079 HasCSS bool
81- WithStyles bool
8280 CssURL template.URL
8381 Tags []string
8482 Image template.URL
......@@ -93,16 +91,14 @@ type PostPageData struct {
9391 }
9492
9593 type HeaderTxt struct {
96- Title string
97- Bio string
98- Nav []shared.Link
99- HasLinks bool
100- Layout string
101- Image template.URL
102- ImageCard string
103- Favicon template.URL
104- WithStyles bool
105- Domain string
94+ Title string
95+ Bio string
96+ Nav []shared.Link
97+ HasLinks bool
98+ Image template.URL
99+ ImageCard string
100+ Favicon template.URL
101+ Domain string
106102 }
107103
108104 type ReadmeTxt struct {
......@@ -197,11 +193,9 @@ func blogHandler(w http.ResponseWriter, r *http.Request) {
197193 }
198194
199195 headerTxt := &HeaderTxt{
200- Title: GetBlogName(username),
201- Bio: "",
202- Layout: "default",
203- ImageCard: "summary",
204- WithStyles: true,
196+ Title: GetBlogName(username),
197+ Bio: "",
198+ ImageCard: "summary",
205199 }
206200 readmeTxt := &ReadmeTxt{}
207201
......@@ -212,10 +206,8 @@ func blogHandler(w http.ResponseWriter, r *http.Request) {
212206 logger.Error("readme", "err", err.Error())
213207 }
214208 headerTxt.Bio = parsedText.Description
215- headerTxt.Layout = parsedText.Layout
216209 headerTxt.Image = template.URL(parsedText.Image)
217210 headerTxt.ImageCard = parsedText.ImageCard
218- headerTxt.WithStyles = parsedText.WithStyles
219211 headerTxt.Favicon = template.URL(parsedText.Favicon)
220212 if parsedText.Title != "" {
221213 headerTxt.Title = parsedText.Title
......@@ -265,18 +257,17 @@ func blogHandler(w http.ResponseWriter, r *http.Request) {
265257 }
266258
267259 data := BlogPageData{
268- Site: *cfg.GetSiteData(),
269- PageTitle: headerTxt.Title,
270- URL: template.URL(cfg.FullBlogURL(curl, username)),
271- RSSURL: template.URL(cfg.RssBlogURL(curl, username, tag)),
272- Readme: readmeTxt,
273- Header: headerTxt,
274- Username: username,
275- Posts: postCollection,
276- HasCSS: hasCSS,
277- CssURL: template.URL(cfg.CssURL(username)),
278- HasFilter: tag != "",
279- WithStyles: headerTxt.WithStyles,
260+ Site: *cfg.GetSiteData(),
261+ PageTitle: headerTxt.Title,
262+ URL: template.URL(cfg.FullBlogURL(curl, username)),
263+ RSSURL: template.URL(cfg.RssBlogURL(curl, username, tag)),
264+ Readme: readmeTxt,
265+ Header: headerTxt,
266+ Username: username,
267+ Posts: postCollection,
268+ HasCSS: hasCSS,
269+ CssURL: template.URL(cfg.CssURL(username)),
270+ HasFilter: tag != "",
280271 }
281272
282273 err = ts.Execute(w, data)
......@@ -386,7 +377,6 @@ func postHandler(w http.ResponseWriter, r *http.Request) {
386377 ogImage := ""
387378 ogImageCard := ""
388379 hasCSS := false
389- withStyles := true
390380 var data PostPageData
391381
392382 css, err := dbpool.FindPostWithFilename("_styles.css", user.ID, cfg.Space)
......@@ -416,7 +406,6 @@ func postHandler(w http.ResponseWriter, r *http.Request) {
416406 if readmeParsed.Title != "" {
417407 blogName = readmeParsed.Title
418408 }
419- withStyles = readmeParsed.WithStyles
420409 ogImage = readmeParsed.Image
421410 ogImageCard = readmeParsed.ImageCard
422411 favicon = readmeParsed.Favicon
......@@ -489,7 +478,6 @@ func postHandler(w http.ResponseWriter, r *http.Request) {
489478 Footer: footerHTML,
490479 Unlisted: unlisted,
491480 Diff: template.HTML(diff),
492- WithStyles: withStyles,
493481 List: list,
494482 }
495483 } else {
......@@ -537,7 +525,6 @@ func postHandler(w http.ResponseWriter, r *http.Request) {
537525 Footer: footerHTML,
538526 Contents: contents,
539527 Unlisted: true,
540- WithStyles: withStyles,
541528 }
542529 w.WriteHeader(http.StatusNotFound)
543530 }
+3 -18 pkg/shared/mdparser.go #
......@@ -35,12 +35,10 @@ type MetaData struct {
3535 Nav []Link
3636 Tags []string
3737 Aliases []string
38- Layout string
3938 Image string
4039 ImageCard string
4140 Favicon string
4241 Hidden bool
43- WithStyles bool
4442 Domain string
4543 }
4644
......@@ -215,10 +213,9 @@ func CreateGoldmark(extenders ...goldmark.Extender) goldmark.Markdown {
215213 func ParseText(text string) (*ParsedText, error) {
216214 parsed := ParsedText{
217215 MetaData: &MetaData{
218- Tags: []string{},
219- Aliases: []string{},
220- WithStyles: true,
221- PublishAt: &time.Time{},
216+ Tags: []string{},
217+ Aliases: []string{},
218+ PublishAt: &time.Time{},
222219 },
223220 }
224221 hili := highlighting.NewHighlighting(
......@@ -283,12 +280,6 @@ func ParseText(text string) (*ParsedText, error) {
283280 }
284281 parsed.Domain = domain
285282
286- layout, err := toString(metaData["layout"])
287- if err != nil {
288- return &parsed, fmt.Errorf("front-matter field (%s): %w", "layout", err)
289- }
290- parsed.Layout = layout
291-
292283 image, err := toString(metaData["image"])
293284 if err != nil {
294285 return &parsed, fmt.Errorf("front-matter field (%s): %w", "image", err)
......@@ -307,12 +298,6 @@ func ParseText(text string) (*ParsedText, error) {
307298 }
308299 parsed.Hidden = hidden
309300
310- withStyles, err := toBool(metaData["with_styles"], true)
311- if err != nil {
312- return &parsed, fmt.Errorf("front-matter field (%s): %w", "with_style", err)
313- }
314- parsed.WithStyles = withStyles
315-
316301 favicon, err := toString(metaData["favicon"])
317302 if err != nil {
318303 return &parsed, fmt.Errorf("front-matter field (%s): %w", "favicon", err)
Back to top