-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #429 from carpentries/add404
add 404 page support
- Loading branch information
Showing
5 changed files
with
62 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
build_404 <- function(pkg, quiet) { | ||
page_globals <- setup_page_globals() | ||
path <- root_path(pkg$src_path) | ||
fof <- fs::path_package("sandpaper", "templates", "404-template.txt") | ||
html <- xml2::read_html(render_html(fof)) | ||
fix_nodes(html) | ||
|
||
this_dat <- list( | ||
this_page = "404.html", | ||
body = use_instructor(html), | ||
pagetitle = "Page not found" | ||
) | ||
page_globals$instructor$update(this_dat) | ||
|
||
this_dat$body = use_learner(html) | ||
page_globals$learner$update(this_dat) | ||
|
||
page_globals$meta$update(this_dat) | ||
|
||
build_html(template = "extra", pkg = pkg, nodes = html, | ||
global_data = page_globals, path_md = "404.html", quiet = quiet) | ||
} |
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,16 @@ | ||
--- | ||
title: "Page not found" | ||
--- | ||
|
||
## Our apologies! | ||
|
||
We cannot seem to find the page you are looking for. Here are some tips that may | ||
help: | ||
|
||
1. try going back to the <a href="javascript:history.back()">previous page</a> or | ||
2. navigate to any other page using the navigation bar on the left. | ||
3. if the URL ends with `/index.html`, try removing that. | ||
4. head over to the [home page of this lesson](index.html) | ||
|
||
If you came here from a link in this lesson, please contact the lesson | ||
maintainers using the links at the foot of this page. |
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