-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
153 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package generator | ||
|
||
import ( | ||
"bytes" | ||
"path/filepath" | ||
"pugo/pkg/utils/zlog" | ||
) | ||
|
||
type renderErrorPageParams struct { | ||
renderBaseParams | ||
SiteTitle string | ||
} | ||
|
||
func renderErrorPage(params *renderErrorPageParams) error { | ||
notFoundTpl := params.Render.GetTemplate("404") | ||
tplData := params.Ctx.createTemplateData(map[string]interface{}{ | ||
"current": map[string]interface{}{ | ||
"Title": params.SiteTitle, | ||
}, | ||
}) | ||
|
||
buf := bytes.NewBuffer(nil) | ||
if err := params.Render.Execute(buf, notFoundTpl, tplData); err != nil { | ||
zlog.Warn("failed to render 404", "err", err) | ||
return err | ||
} | ||
link := "/404.html" | ||
dstFile := filepath.Join(params.OutputDir, link) | ||
params.Ctx.SetOutput(dstFile, link, buf) | ||
zlog.Infof("404 generated: %s", dstFile) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
{{template "head.html" .}} | ||
|
||
<body> | ||
{{template "header.html" .}} | ||
<main class="main"> | ||
<div class="main-container"> | ||
<div class="not-found"> | ||
<h1>404</h1> | ||
<p>Sorry, this page does not exist.</p> | ||
<p>You can head back to the <a href="/">homepage</a>.</p> | ||
</div> | ||
</div> | ||
</main> | ||
{{template "footer.html" .}} | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,4 +48,5 @@ | |
{{end -}} | ||
{{end -}} | ||
|
||
|
||
{{end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
<div class="sidebar"> | ||
<div class="sidebar-profile"> | ||
<div class="profile-card mx-auto"> | ||
<img class="profile-avatar" src="{{.author.AvatarLink}}" alt=""> | ||
<div class="profile-name">{{.author.Name}}</div> | ||
<div class="profile-bio">{{.author.Bio}}</div> | ||
{{if .author.HasSocials}}{{template "partial/social.html" .}}{{end}} | ||
<div class="main-sidebar"> | ||
<div class="sidebar"> | ||
<div class="sidebar-profile"> | ||
<div class="profile-card mx-auto"> | ||
<img class="profile-avatar" src="{{.author.AvatarLink}}" alt=""> | ||
<div class="profile-name">{{.author.Name}}</div> | ||
<div class="profile-bio">{{.author.Bio}}</div> | ||
{{if .author.HasSocials}}{{template "partial/social.html" .}}{{end}} | ||
</div> | ||
</div> | ||
</div> | ||
<div class="sidebar-tags"> | ||
<h4 class="tags-title">Tags</h4> | ||
<div class="tags-list"> | ||
{{range .tags}}<a | ||
class="" | ||
href="{{.Link}}"> | ||
{{.Name}}<span | ||
class="tags-post-count">{{.PostCount}}</span> | ||
</a>{{end}} | ||
<div class="sidebar-tags"> | ||
<h4 class="tags-title">Tags</h4> | ||
<div class="tags-list"> | ||
{{range .tags}}<a class="" href="{{.Link}}"> | ||
{{.Name}}<span class="tags-post-count">{{.PostCount}}</span> | ||
</a>{{end}} | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
Oops, something went wrong.