main #3
2 changed files with 12 additions and 4 deletions
10
src/components/read.nim
Normal file
10
src/components/read.nim
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
import happyx, os
|
||||||
|
|
||||||
|
component Read:
|
||||||
|
title: string
|
||||||
|
|
||||||
|
if !fileExists("/public/Blog/{self.title}.html"):
|
||||||
|
route "/404"
|
||||||
|
|
||||||
|
`template`:
|
||||||
|
tIframe(src="/public/Blog/{self.title}.html", class="flex items-center flex-1 m-14 max-md:m-7 max-sm:m-0 rounded-3xl max-sm:rounded-none")
|
|
@ -1,7 +1,7 @@
|
||||||
import
|
import
|
||||||
happyx,
|
happyx,
|
||||||
path_params,
|
path_params,
|
||||||
components/[nav, glass]
|
components/[nav, glass, read]
|
||||||
|
|
||||||
appRoutes("app"):
|
appRoutes("app"):
|
||||||
"/":
|
"/":
|
||||||
|
@ -14,9 +14,7 @@ appRoutes("app"):
|
||||||
|
|
||||||
"/<article>":
|
"/<article>":
|
||||||
component Nav
|
component Nav
|
||||||
component Glass($article)
|
component Read($article)
|
||||||
# TODO: pass article title to component which renders the article; modify Glass or a new component is needed
|
|
||||||
# TODO: check if article name exists otherwise route to /404
|
|
||||||
|
|
||||||
notfound:
|
notfound:
|
||||||
route "/404"
|
route "/404"
|
Loading…
Add table
Reference in a new issue