Skip to content

Commit

Permalink
add sitemap_file as a global option (#1049)
Browse files Browse the repository at this point in the history
* closes #1047 adding sitemap_file global variable

* small patch

* adding sitemap_filename alias
  • Loading branch information
tlienart authored Aug 18, 2023
1 parent f1f7d04 commit 7cdbba6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 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 <tlienart@me.com>"]
version = "0.10.89"
version = "0.10.90"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
3 changes: 2 additions & 1 deletion src/manager/robots_generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ function robots_generator()
dst = joinpath(path(:site), "robots.txt")
isfile(dst) && rm(dst)
io = IOBuffer()
sitemap_file = splitext(globvar(:sitemap_file))[1] * ".xml"
globvar(:generate_sitemap)::Bool && println(io, """
Sitemap: $(joinpath(globvar(:website_url)::String, "sitemap.xml"))
Sitemap: $(joinpath(globvar(:website_url)::String, sitemap_file))
""")
print(io, """
User-agent: *
Expand Down
3 changes: 2 additions & 1 deletion src/manager/sitemap_generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ $SIGNATURES
Generate a `sitemap.xml`, if one already exists, it will be replaced.
"""
function sitemap_generator()
dst = joinpath(path(:site), "sitemap.xml")
sitemap_file = splitext(globvar(:sitemap_file))[1] * ".xml"
dst = joinpath(path(:site), sitemap_file)
isfile(dst) && rm(dst)
io = IOBuffer()
println(io, """
Expand Down
3 changes: 3 additions & 0 deletions src/utils/vars.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const GLOBAL_VARS_DEFAULT = [
"rss_full_content" => dpair(false),
# Sitemap
"generate_sitemap" => dpair(true),
"sitemap_file" => dpair("sitemap"),
# div names
"content_tag" => dpair("div"),
"content_class" => dpair("franklin-content"),
Expand Down Expand Up @@ -82,6 +83,8 @@ const GLOBAL_VARS_ALIASES = LittleDict(
"rss_website_url" => "website_url",
"rss_website_descr" => "website_description",
"website_descr" => "website_description",
"rss_filename" => "rss_file",
"sitemap_filename" => "sitemap_file",
)

"""
Expand Down

2 comments on commit 7cdbba6

@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/89882

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.90 -m "<description of version>" 7cdbba65ec816b7c0b2bae9da2a6d3107316a0f0
git push origin v0.10.90

Please sign in to comment.