Skip to content

Commit

Permalink
Sitemap fix for 404.md (#1026)
Browse files Browse the repository at this point in the history
* attempt fix for 404 md

* fixing 404 sitemap

* prep for patch release

* removing 404 from sitemap
  • Loading branch information
tlienart authored May 9, 2023
1 parent 7e08733 commit 4fcbf69
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Franklin"
uuid = "713c75ef-9fc9-4b05-94a9-213340da978e"
authors = ["Thibaut Lienart <[email protected]>"]
version = "0.10.82"
version = "0.10.83"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
6 changes: 3 additions & 3 deletions src/manager/dir_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ end

function _keep_path(base, fname)::Bool
rpath = get_rpath(joinpath(base, fname))
keep = union(globvar(:keep_path)::Vector{String}, ["404.html"])
keep = union(globvar(:keep_path)::Vector{String}, ["404.html", "404"])
isempty(keep) && return false
files = [f for f in keep if endswith(f, ".html")]
dirs = [d for d in keep if endswith(d, "/")]
files = [f for f in keep if endswith(f, ".html") || f == "404"]
dirs = [d for d in keep if endswith(d, "/")]
spath = rpath * ".html"
any(f -> f == spath, files) && return true
any(d -> startswith(spath, d), dirs) && return true
Expand Down
1 change: 1 addition & 0 deletions src/manager/sitemap_generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Add an entry to `SITEMAP_DICT`.
"""
function add_sitemap_item(; html=false)
loc = url_curpage()
endswith(loc, "404.html") && return nothing
locvar(:sitemap_exclude)::Bool && return nothing
if !html
lastmod = locvar(:fd_mtime_raw)
Expand Down
4 changes: 2 additions & 2 deletions src/utils/html.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ 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 = union(globvar(:keep_path)::Vector{String}, ["404.html"])
rpath in keep && return rpath
keep = union(globvar(:keep_path)::Vector{String}, ["404.html", "404.md"])
rpath in keep && return replace(rpath, r"\.md$" => ".html")

fn, ext = splitext(rpath)
if ext != ".html"
Expand Down

2 comments on commit 4fcbf69

@tlienart
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/83178

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.10.83 -m "<description of version>" 4fcbf69eff8fe8c85a3cefbd784d6aabc06c50dc
git push origin v0.10.83

Please sign in to comment.