mirror of
https://github.com/gojp/goreportcard.git
synced 2026-01-28 22:39:05 +08:00
14
handlers/error.go
Normal file
14
handlers/error.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func errorHandler(w http.ResponseWriter, r *http.Request, status int) {
|
||||
w.WriteHeader(status)
|
||||
if status == http.StatusNotFound {
|
||||
t := template.Must(template.New("404.html").ParseFiles("templates/404.html"))
|
||||
t.Execute(w, nil)
|
||||
}
|
||||
}
|
||||
@@ -57,5 +57,5 @@ func HomeHandler(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
http.NotFound(w, r)
|
||||
errorHandler(w, r, http.StatusNotFound)
|
||||
}
|
||||
|
||||
99
templates/404.html
Normal file
99
templates/404.html
Normal file
@@ -0,0 +1,99 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Go Report Card | Go project code quality report cards</title>
|
||||
<link rel="stylesheet" href="https://cdn.rawgit.com/jgthms/bulma/master/css/bulma.min.css">
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', '[[ .google_analytics_key ]]', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.header .is-active {
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header class="header">
|
||||
<div class="container">
|
||||
<!-- Left side -->
|
||||
<div class="header-left">
|
||||
<a class="header-item" href="/">
|
||||
<h3 class="title">Go Report Card</h3>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Hamburger menu (on mobile) -->
|
||||
<span class="header-toggle">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</span>
|
||||
|
||||
<!-- Right side -->
|
||||
<div class="header-right header-menu">
|
||||
<span class="header-item">
|
||||
<a href="/high_scores">High Scores</a>
|
||||
</span>
|
||||
<span class="header-item">
|
||||
<a href="https://github.com/gojp/goreportcard">GitHub</a>
|
||||
</span>
|
||||
<span class="header-item is-active">
|
||||
<a href="/about">About</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<div class="columns">
|
||||
<div class="column is-4 is-hidden-mobile has-text-centered">
|
||||
<img id="gopherimage" src="/assets/gopherhat.jpg">
|
||||
</div>
|
||||
<div class="column is-8 content">
|
||||
<br>
|
||||
<h1 class="title">Page not found!</h1>
|
||||
<p>It seems like the page you are looking for is no longer here. Check the URL for typos, or click below to return to the homepage. If you think this is a mistake, please <a href="https://github.com/gojp/goreportcard/issues">open an issue on Github</a>.</p>
|
||||
<p><h3 class="subtitle"><a href="/">Back to grading Go repos</a></h3></p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<div class="content has-text-centered">
|
||||
<p>
|
||||
<strong>Go Report Card</strong> by
|
||||
<a href="https://twitter.com/shawnps">Shawn Smith</a> and
|
||||
<a href="https://twitter.com/ironzeb">Herman Schaaf</a>.
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://www.digitalocean.com/" class="dolink">
|
||||
<img width="15%" src="/assets/do-proudly-hosted.png">
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<style>
|
||||
#gopherimage {
|
||||
width: 200px;
|
||||
margin: 0;
|
||||
-webkit-animation:spin 2s linear infinite;
|
||||
-moz-animation:spin 2s linear infinite;
|
||||
animation:spin 2s linear infinite;
|
||||
}
|
||||
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
|
||||
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
|
||||
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user