Commit d635a23
Changed files (10)
pkg/templates/layout.gohtml
@@ -16,9 +16,13 @@
{{ template "svg" . }}
<div class="menu">
<div class="menu-content">
- <a href="{{ .RootHref }}index.html" class="project-name">{{ .Name }}</a>
+ {{ if ne .SiteName "" }}
+ <a href="{{ .RootHref }}index.html" class="project-name">{{ .SiteName }}</a>
+ {{ end }}
+ {{ if not .IsMultiRepoIndex }}
+ <a href="{{ .RepoHref }}index.html" class="project-name">{{ .Name }}</a>
<div class="menu-item {{ if eq .Selected "code" }}selected{{ end }}">
- <a href="{{ .RootHref }}blob/{{ .CurrentRefDir }}/index.html">
+ <a href="{{ .RepoHref }}blob/{{ .CurrentRefDir }}/index.html">
<svg aria-hidden="true" width="16" height="16">
<use xlink:href="#code"></use>
</svg>
@@ -26,7 +30,7 @@
</a>
</div>
<div class="menu-item {{ if eq .Selected "branches" }}selected{{ end }}">
- <a href="{{ .RootHref }}branches.html">
+ <a href="{{ .RepoHref }}branches.html">
<svg aria-hidden="true" focusable="false" width="16" height="16">
<use xlink:href="#branch"></use>
</svg>
@@ -34,7 +38,7 @@
</a>
</div>
<div class="menu-item {{ if eq .Selected "tags" }}selected{{ end }}">
- <a href="{{ .RootHref }}tags.html">
+ <a href="{{ .RepoHref }}tags.html">
<svg aria-hidden="true" focusable="false" width="16" height="16">
<use xlink:href="#tag"></use>
</svg>
@@ -42,13 +46,14 @@
</a>
</div>
<div class="menu-item {{ if eq .Selected "commits" }}selected{{ end }}">
- <a href="{{ .RootHref }}commits/{{ .CurrentRefDir }}/index.html">
+ <a href="{{ .RepoHref }}commits/{{ .CurrentRefDir }}/index.html">
<svg aria-hidden="true" focusable="false" width="16" height="16">
<use xlink:href="#commit"></use>
</svg>
Commits
</a>
</div>
+ {{ end }}
</div>
</div>
<main>
pkg/templates/templates.go
@@ -67,14 +67,17 @@ var previewContent string
var PreviewTemplate = Must(New("preview").Parse(previewContent))
type LayoutParams struct {
- Title string
- Name string
- Dark bool
- CSSMarkdown CSS
- RootHref string
- CurrentRefDir string
- Selected string
- InlineStyles bool
+ Title string
+ Name string
+ SiteName string
+ Dark bool
+ CSSMarkdown CSS
+ RootHref string
+ RepoHref string
+ CurrentRefDir string
+ Selected string
+ InlineStyles bool
+ IsMultiRepoIndex bool
}
type HeaderParams struct {
blob.go
@@ -140,7 +140,9 @@ func generateBlobs(files []git.Blob, params Params) error {
Dark: params.Dark,
CSSMarkdown: cssMarkdown(params.Dark),
Name: params.Name,
+ SiteName: params.SiteName,
RootHref: rootHref,
+ RepoHref: rootHref,
CurrentRefDir: params.Ref.DirName(),
Selected: "code",
InlineStyles: params.InlineStyles,
@@ -199,7 +201,9 @@ func generateBlobs(files []git.Blob, params Params) error {
Title: fmt.Sprintf("%s/%s at %s", params.Name, blob.Path, params.Ref),
Dark: params.Dark,
Name: params.Name,
+ SiteName: params.SiteName,
RootHref: rootHref,
+ RepoHref: rootHref,
CurrentRefDir: params.Ref.DirName(),
Selected: "code",
InlineStyles: params.InlineStyles,
branches.go
@@ -50,8 +50,10 @@ func generateBranches(branches []git.Ref, defaultBranch string, params Params) e
LayoutParams: templates.LayoutParams{
Title: fmt.Sprintf("Branches %s %s", dot, params.Name),
Name: params.Name,
+ SiteName: params.SiteName,
Dark: params.Dark,
RootHref: rootHref,
+ RepoHref: rootHref,
CurrentRefDir: params.DefaultRef.DirName(),
Selected: "branches",
InlineStyles: params.InlineStyles,
commit.go
@@ -238,8 +238,10 @@ func generateCommitPage(commit git.Commit, params Params) error {
LayoutParams: templates.LayoutParams{
Title: fmt.Sprintf("%s %s %s@%s", commit.Subject, dot, params.Name, commit.ShortHash),
Name: params.Name,
+ SiteName: params.SiteName,
Dark: params.Dark,
RootHref: rootHref,
+ RepoHref: rootHref,
CurrentRefDir: currentRef.DirName(),
Selected: "commits",
InlineStyles: params.InlineStyles,
commits_list.go
@@ -64,8 +64,10 @@ func generateLogForBranch(allCommits []git.Commit, params Params) error {
LayoutParams: templates.LayoutParams{
Title: fmt.Sprintf("Commits %s %s", dot, params.Name),
Name: params.Name,
+ SiteName: params.SiteName,
Dark: params.Dark,
RootHref: rootHref,
+ RepoHref: rootHref,
CurrentRefDir: params.Ref.DirName(),
Selected: "commits",
InlineStyles: params.InlineStyles,
index.go
@@ -102,9 +102,11 @@ func generateIndex(files []git.Blob, params Params) error {
LayoutParams: templates.LayoutParams{
Title: title,
Name: params.Name,
+ SiteName: params.SiteName,
Dark: params.Dark,
CSSMarkdown: cssMarkdown(params.Dark),
RootHref: rootHref,
+ RepoHref: rootHref,
CurrentRefDir: params.Ref.DirName(),
Selected: "code",
InlineStyles: params.InlineStyles,
list.go
@@ -185,9 +185,11 @@ func generateLists(files []git.Blob, params Params) error {
LayoutParams: templates.LayoutParams{
Title: title,
Name: params.Name,
+ SiteName: params.SiteName,
Dark: params.Dark,
CSSMarkdown: CSSMarkdown,
RootHref: rootHref,
+ RepoHref: rootHref,
CurrentRefDir: params.Ref.DirName(),
Selected: "code",
InlineStyles: params.InlineStyles,
main.go
@@ -33,6 +33,7 @@ var (
type Params struct {
Owner string
Name string
+ SiteName string
RepoDir string
Ref git.Ref
OutputDir string
@@ -41,6 +42,7 @@ type Params struct {
StyleDark string
Dark bool
DefaultRef git.Ref
+ RootPrefix string
InlineStyles bool
}