diff --git a/demos/404.html b/demos/404.html new file mode 100644 index 000000000..14a6acc04 --- /dev/null +++ b/demos/404.html @@ -0,0 +1,8 @@ + + + +

+ This is a 404 page, oops. +

+ + diff --git a/demos/config.md b/demos/config.md index 2dbaf9768..9167f85ce 100644 --- a/demos/config.md +++ b/demos/config.md @@ -10,6 +10,8 @@ mathjax = false ignore = ["foo/content.md"] weave = false +generate_sitemap = true + # supports question 001 members_from_csv = eachrow(readdlm("_assets/members.csv", ',', skipstart=1)) +++ diff --git a/src/manager/dir_utils.jl b/src/manager/dir_utils.jl index 8316b18ae..911b39546 100644 --- a/src/manager/dir_utils.jl +++ b/src/manager/dir_utils.jl @@ -34,7 +34,7 @@ function form_output_path(base::AS, file::AS, case::Symbol) # file is index.html or 404.html or in keep_path --> keep the path # file is page.html --> .../page/index.html fname = splitext(file)[1] - if fname ∉ ("index", "404") && !endswith(fname, "/index") && !_keep_path(base, fname) + if fname != "index" && !endswith(fname, "/index") && !_keep_path(base, fname) file = joinpath(fname, "index.html") end end @@ -64,7 +64,7 @@ end function _keep_path(base, fname)::Bool rpath = get_rpath(joinpath(base, fname)) - keep = globvar(:keep_path)::Vector{String} + keep = union(globvar(:keep_path)::Vector{String}, ["404.html"]) isempty(keep) && return false files = [f for f in keep if endswith(f, ".html")] dirs = [d for d in keep if endswith(d, "/")] diff --git a/src/utils/html.jl b/src/utils/html.jl index 9d17ed4e1..245d1f965 100644 --- a/src/utils/html.jl +++ b/src/utils/html.jl @@ -125,7 +125,7 @@ Helper function to get the relative url of the current page. function url_curpage() # get the relative path to current page and split extension (.md) rpath = locvar(:fd_rpath) - keep = globvar(:keep_path)::Vector{String} + keep = union(globvar(:keep_path)::Vector{String}, ["404.html"]) rpath in keep && return rpath fn, ext = splitext(rpath)