Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Add 404.html page #11428

Merged
merged 2 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/compiler/crystal/tools/doc/generator.cr
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ class Crystal::Doc::Generator
main_index = Main.new(raw_body, Type.new(self, @program), project_info)
File.write File.join(@output_dir, "index.json"), main_index
File.write File.join(@output_dir, "search-index.js"), main_index.to_jsonp

File.write File.join(@output_dir, "404.html"), MainTemplate.new(Error404Template.new.to_s, types, project_info)
end

def generate_sitemap(types)
Expand Down
7 changes: 7 additions & 0 deletions src/compiler/crystal/tools/doc/html/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<h1 class="type-name">
404 Not Found
</h1>

<p>
This page is unavailable in this version of the API docs.
</p>
straight-shoota marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions src/compiler/crystal/tools/doc/templates.cr
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ module Crystal::Doc
ECR.def_to_s "#{__DIR__}/html/_sidebar.html"
end

record Error404Template do
ECR.def_to_s "#{__DIR__}/html/404.html"
end

struct JsTypeTemplate
ECR.def_to_s "#{__DIR__}/html/js/doc.js"
end
Expand Down