63 lines
1.6 KiB
Plaintext
63 lines
1.6 KiB
Plaintext
package layouts
|
|
|
|
import (
|
|
"forge.capytal.company/capytalcode/project-comicverse/configs"
|
|
)
|
|
|
|
type PageInfo struct {
|
|
Title string
|
|
Description string
|
|
Author string
|
|
Keywords string
|
|
ThemeColor string
|
|
Heading templ.Component
|
|
}
|
|
|
|
func pageInfo(info []PageInfo) PageInfo {
|
|
if len(info) != 0 {
|
|
return info[0]
|
|
}
|
|
return PageInfo{}
|
|
}
|
|
|
|
templ Page(i ...PageInfo) {
|
|
<html lang="en-US">
|
|
<head>
|
|
// Page information
|
|
if pageInfo(i).Title != "" {
|
|
<title>{ pageInfo(i).Title + " - " + configs.APP_NAME }</title>
|
|
} else {
|
|
<title>Comicverse</title>
|
|
}
|
|
if pageInfo(i).Author != "" {
|
|
<meta name="author" content={ pageInfo(i).Author }/>
|
|
} else {
|
|
<meta name="author" content={ configs.APP_NAME }/>
|
|
}
|
|
if pageInfo(i).Description != "" {
|
|
<meta name="description" content={ pageInfo(i).Description }/>
|
|
}
|
|
<meta name="publisher" content={ configs.APP_NAME }/>
|
|
// Page configuration
|
|
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1"/>
|
|
<meta name="referrer" content="strict-origin-when-cross-origin"/>
|
|
<meta name="color-scheme" content="dark light"/>
|
|
if pageInfo(i).ThemeColor != "" {
|
|
<meta name="theme-color" content={ pageInfo(i).ThemeColor }/>
|
|
}
|
|
// Global styles
|
|
<link href="/assets/css/theme.css" rel="stylesheet"/>
|
|
<link href="/assets/css/uno.css" rel="stylesheet"/>
|
|
// Global scripts
|
|
<script type="module" src="/assets/js/entry.js" defer></script>
|
|
// Additional heading
|
|
if pageInfo(i).Heading != nil {
|
|
@pageInfo(i).Heading
|
|
}
|
|
</head>
|
|
<body>
|
|
{ children... }
|
|
</body>
|
|
</html>
|
|
}
|