forked from james/jtm.dev
flushing out the W.D. so I can start anew
parent
20efd8efe7
commit
e20191c01b
17
Main.hs~
17
Main.hs~
|
@ -1,17 +0,0 @@
|
|||
module Main where
|
||||
|
||||
type Seconds = Int
|
||||
type DomainName = String
|
||||
type Url = (DomainName, String)
|
||||
type UserAgent = String
|
||||
|
||||
data RobotsTxt = RobotsTxt
|
||||
{ crawlDelay :: Seconds
|
||||
, canonicalDomain :: DomainName
|
||||
, sitemapLocation :: Url
|
||||
, globalDisallows :: [Url]
|
||||
, botDisallows :: [(UserAgent, [Url])]
|
||||
}
|
||||
|
||||
main :: IO ()
|
||||
main = putStrLn ""
|
|
@ -1,27 +0,0 @@
|
|||
module SitemapXml where
|
||||
|
||||
type Sitemap = [UrlData]
|
||||
|
||||
data ChangeFreq = CFNever
|
||||
| CFYearly
|
||||
| CFMonthly
|
||||
| CFWeekly
|
||||
| CFDaily
|
||||
| CFHourly
|
||||
| CFAlways
|
||||
|
||||
instance Show ChangeFreq where
|
||||
show CFNever = "never"
|
||||
show CFYearly = "yearly"
|
||||
show CFMonthly = "monthly"
|
||||
show CFWeekly = "weekly"
|
||||
show CFDaily = "daily"
|
||||
show CFHourly = "hourly"
|
||||
show CFAlways = "always"
|
||||
|
||||
data UrlData = UrlData
|
||||
{ url :: String
|
||||
, lastMod :: Maybe String
|
||||
, changeFreq :: ChangeFreq
|
||||
, priority :: Priority
|
||||
}
|
18
robots.rkt~
18
robots.rkt~
|
@ -1,18 +0,0 @@
|
|||
#lang racket
|
||||
(define (robots-field name (body '()))
|
||||
(define robots-field-base (string-append name ":"))
|
||||
(if (nil? body) robots-field-base
|
||||
(string-append robots-field-base " " body)))
|
||||
|
||||
(define (robots-ua (name "*"))
|
||||
(string-append "User-agent: " name))
|
||||
|
||||
(define (robots-disallow list)
|
||||
(if (empty? list)
|
||||
"Disallow:"
|
||||
|
||||
(define (robots-config (#:crawl-delay 10))
|
||||
(string-append
|
||||
(robots-ua)
|
||||
(
|
||||
|
15
site.rkt~
15
site.rkt~
|
@ -1,15 +0,0 @@
|
|||
#lang racket
|
||||
(require "sitemap.rkt")
|
||||
(require "robots.rkt")
|
||||
|
||||
(define base-url "https://lijero.co")
|
||||
|
||||
(define (site-page url body #:priority priority #:lastmod lastmod #:changefreq changefreq)
|
||||
(cons (sitemap-url (string-append base-url url) #:priority priority #:lastmod lastmod #:changefreq changefreq)
|
||||
(cons url (xexprs body))))
|
||||
|
||||
(define (gen-site pages)
|
||||
(define sitemap-urls (append* (map (match-lambda ([cons sitemap _] sitemap)) pages)))
|
||||
(define page-bodies (append* (map (match-lambda ([cons _ page] page)) pages)))
|
||||
(cons (sitemap sitemap-urls)
|
||||
(page-bodies)
|
|
@ -1,8 +0,0 @@
|
|||
#lang racket
|
||||
(require "xexprs/xexprs.rkt")
|
||||
|
||||
(define (sitemap urls)
|
||||
(string-append
|
||||
"<?xml version="1.0" encoding="UTF-8"?>"
|
||||
(xexprs
|
||||
`(urlset #:xmlns "http://www.sitemaps.org/schemas/sitemap/0.9" ,@urls))))
|
Loading…
Reference in New Issue