diff options
| Commit | e97af60a826212f4fa5cc50e950401162b1e34d5 (patch) | |
|---|---|---|
| Author | 2025-08-18 19:45:37 +0300 | |
| Committer | 2025-08-18 19:45:37 +0300 | |
| Files | 369e7ecf99178ab71b4994175d08b974df79bb68 /meta | |
| syndamia.com-e97af60a826212f4fa5cc50e950401162b1e34d5.tar syndamia.com-e97af60a826212f4fa5cc50e950401162b1e34d5.tar.gz syndamia.com-e97af60a826212f4fa5cc50e950401162b1e34d5.zip | ||
| Parent | 594b2cb3aa351a04064ea1f2ca62ad99318fd423 (diff) | |
feat(meta): Generate sitemap
1 files changed, 14 insertions, 0 deletions
| -rw-r--r-- | meta/meta.awk | 14 |
diff --git a/meta/meta.awk b/meta/meta.awk index b1023c2..3f416f1 100644 --- a/meta/meta.awk +++ b/meta/meta.awk @@ -12,16 +12,30 @@ BEGIN { HEADER = getfile(ENVIRON["HEADER"]) FOOTER = getfile(ENVIRON["FOOTER"]) + sitemap = ENVIRON["GEN_DIR"] "/sitemap.xml" + print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ORS \ + "<urlset" ORS \ + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" ORS \ + "xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9" ORS \ + "http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\"" ORS \ + "xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">" > sitemap + for (i = ARGC; i > 0; --i) { if (!ARGV[i]) continue + #-- Add header and footer --# start = HEADER FILENAME = substr(ARGV[i], length(ENVIRON["GEN_DIR"]) + 2) gsub(/\$TITLE/, meta_title[FILENAME], start) gsub(/\$DESCRIPTION/, meta_description[FILENAME], start) print start getfile(ARGV[i]) FOOTER > ARGV[i] + + #-- Add to sitemap --# + print "<url><loc>" ENVIRON["URL"] substr(ARGV[i], length(ENVIRON["GEN_DIR"]) + 1) "</loc><lastmod>" date "</lastmod><priority>1.0</priority></url>" > sitemap } + + print "</urlset>" > sitemap } function getfile(filename, status, linebuf, filebuf) { |