Add the ability to include a CSS sheet link.
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

The output page no states Package Set rather than just Package.
This commit is contained in:
Captain ALM 2022-07-12 11:16:03 +01:00
parent 012d464128
commit 2e5c296a7c
Signed by: alfred
GPG Key ID: 4E4ADD02609997B1
5 changed files with 11 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import "golang.captainalm.com/GOPackageHeaderServer/outputMeta"
type ZoneYaml struct {
Name string `yaml:"name"`
Domains []string `yaml:"domains"`
CssURL string `yaml:"cssURL"`
HavePageContents bool `yaml:"havePageContents"`
BasePath string `yaml:"basePath"`
UsernameProvided bool `yaml:"usernameProvided"`

View File

@ -8,6 +8,7 @@ listen: #HTTP server settings
zones: #An array of zones
- name: test #The name of the package set
domains: ["localhost:8080"] #An array of domains this package set use (Each domain can only be registered with one zone)
cssURL: "http://localhost/sheet.css" #A URL to the CSS file to use for outputted pages (If blank or not provided, no CSS is included)
havePageContents: true #Output a header and link to the target repo
basePath: "localhost" #The base-path, also known as, package name
basePrefixURL: "http://localhost" #The base git URL

View File

@ -1,8 +1,13 @@
<!DOCTYPE html>
<html>
<head>
{{ if .PageHandler.OutputPage }}
{{ if isNotEmpty .PageHandler.Name }}
<title>Go Package: {{ .PageHandler.Name }}</title>
<title>Go Package Set: {{ .PageHandler.Name }}</title>
{{ end }}
{{ if isNotEmpty .PageHandler.CSS }}
<link rel="stylesheet" type="text/css" href="{{ .PageHandler.CSS }}">
{{ end }}
{{ end }}
<meta name="go-import" content="{{ .GetGoImportMetaContent }}">
<meta name="go-source" content="{{ .GetGoSourceMetaContent }}">
@ -10,7 +15,7 @@
<body>
{{ if .PageHandler.OutputPage }}
{{ if isNotEmpty .PageHandler.Name }}
<h1>Go Package: {{ .PageHandler.Name }}</h1>
<h1>Go Package Set: {{ .PageHandler.Name }}</h1>
{{ end }}
<a href="{{ .GetLink }}">{{ .GetLink }}</a>
{{ end }}

View File

@ -10,6 +10,7 @@ import (
type PageHandler struct {
Name string
CSS string
OutputPage bool
MetaOutput *outputMeta.PackageMetaTagOutputter
}

View File

@ -14,6 +14,7 @@ func New(yaml conf.ConfigYaml) (*http.Server, map[string]*PageHandler) {
for _, zc := range yaml.Zones {
currentPage := &PageHandler{
Name: zc.Name,
CSS: zc.CssURL,
OutputPage: zc.HavePageContents,
MetaOutput: zc.GetPackageMetaTagOutputter(),
}