Skip to content

Commit

Permalink
update new blog script
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahilea committed Jan 23, 2025
1 parent cccf8c5 commit 4375850
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions add_stuff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,11 @@ function new_blog_post()
pub_date = Dates.format(now(), dateformat"e, d u yyyy HH:MM:SS ") * "EST"

@info "Creating new blog directory" blog_title dir_name
cp(joinpath("blog", "__template"), dir)
for file in readdir(dir; join=true)
if endswith(file, ".rss.xml") || endswith(file, ".template.html")
rm(file)
continue
end
startswith(basename(file), ".") && continue
mkpath(dir)

let
file = joinpath(dir, "src.md")
cp(joinpath("blog", "__template", "src.md.template"), file)

@info "Updating $file..."
str = read(file, String)
Expand All @@ -71,12 +69,10 @@ function new_blog_post()
str = replace(str, "{{ PUB_DATE }}" => pub_date)
str = replace(str, "{{ BLOG_DIR }}" => dir_name)
write(file, str)

mv(file, replace(file, ".template" => ""))
end
mkdir(joinpath(dir, "assets"))
cp(joinpath("assets", "img", "emojis", "surprise-pikachu.png"),
joinpath(dir, "assets", "thumbnail.png"))
# cp(joinpath("assets", "img", "emojis", "surprise-pikachu.png"),
# joinpath(dir, "assets", "thumbnail.png"))

@info "Do ctrl+f TODO to find regions to update for newly added project!"
end
Expand Down

0 comments on commit 4375850

Please sign in to comment.