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

fix for sitemap generation: loc of 404.html [#1011] #1024

Merged
merged 2 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions demos/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<body>
<h1>
This is a 404 page, oops.
</h1>
</body>
</html>
2 changes: 2 additions & 0 deletions demos/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
+++
Expand Down
4 changes: 2 additions & 2 deletions src/manager/dir_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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, "/")]
Expand Down
2 changes: 1 addition & 1 deletion src/utils/html.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down