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

View File

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