Move web archives into dedicated directory

This commit is contained in:
David Eisinger
2023-04-29 20:47:05 -04:00
parent f5e5481eb6
commit b7b58cf3ab
8 changed files with 5 additions and 5 deletions

View File

@@ -4,10 +4,10 @@ require "uri"
require "digest"
require "time"
path, *urls = ARGV
*urls = ARGV
unless path && urls.any?
warn "Please supply a path and url"
unless urls.any?
warn "Please supply one or more URLs"
exit 1
end
@@ -36,7 +36,7 @@ urls.each do |url|
filename = "#{URI.parse(url).host.gsub(".", "-")}-#{hash}.txt"
File.write("#{path}/#{filename}", text_content)
File.write("static/archive/#{filename}", text_content)
puts <<~STR
- title: "#{title}"

View File

@@ -27,7 +27,7 @@
{{ range . }}
<li>
<a href="{{ .url }}">{{ .title }}</a>”;
<a href="{{ .file }}">
<a href="/archive/{{ .file }}">
backed up {{ .date | time.Format "2006-01-02 15:04:05 MST" }}
</a>
</li>