More files for all sites.

Two verification files for google/bing website tools, and also add a
no-op robots.txt file to avoid error-log lines.
This commit is contained in:
Eli Barzilay 2012-06-27 09:19:18 -04:00
parent 06f67b30f3
commit fb2b5418df
3 changed files with 49 additions and 37 deletions

View File

@ -1,6 +1,6 @@
#lang at-exp racket/base
(require scribble/html (for-syntax racket/base syntax/name)
(require scribble/html (for-syntax racket/base syntax/name syntax/parse)
"utils.rkt" "resources.rkt")
(define-for-syntax (process-contents who layouter stx xs)
@ -210,33 +210,36 @@
;; site) to have its own resources (and possibly other customizations).
(provide define+provide-context define-context)
(define-for-syntax (make-define+provide-context stx provide?)
(define (make-it dir [resources #f])
(with-syntax ([dir dir]
[page-id (datum->syntax stx 'page)]
[plain-id (datum->syntax stx 'plain)]
[copyfile-id (datum->syntax stx 'copyfile)]
[symlink-id (datum->syntax stx 'symlink)]
[resources-id (datum->syntax stx 'the-resources)])
(with-syntax ([resources (or resources #'(make-resources
(make-resource-files dir)))]
[provides (if provide?
#'(provide page-id plain-id copyfile-id
symlink-id resources-id)
#'(begin))])
#'(begin
(define resources-id resources)
(define-syntax-rule (page-id . xs)
(page #:resources resources-id #:dir dir . xs))
(define-syntax-rule (plain-id . xs)
(plain #:dir dir . xs))
(define (copyfile-id source [target #f])
(copyfile-resource source target #:dir dir))
(define (symlink-id source [target #f])
(symlink-resource source target #:dir dir))
provides))))
(syntax-case stx ()
[(_ dir) (make-it #'dir)]
[(_ dir #:resources resources) (make-it #'dir #'resources)]))
(syntax-parse stx
[(_ (~or (~optional dir:expr)
(~optional (~seq #:resources resources))
(~optional (~seq #:robots.txt robots.txt)
#:defaults ([robots.txt #'#t])))
...)
(unless (attribute dir)
(raise-syntax-error 'define-context "missing <dir>"))
(with-syntax ([page-id (datum->syntax stx 'page)]
[plain-id (datum->syntax stx 'plain)]
[copyfile-id (datum->syntax stx 'copyfile)]
[symlink-id (datum->syntax stx 'symlink)]
[resources-id (datum->syntax stx 'the-resources)])
(with-syntax ([resources (or (attribute resources)
#'(make-resources (make-resource-files
dir robots.txt)))]
[provides (if provide?
#'(provide page-id plain-id copyfile-id
symlink-id resources-id)
#'(begin))])
#'(begin (define resources-id resources)
(define-syntax-rule (page-id . xs)
(page #:resources resources-id #:dir dir . xs))
(define-syntax-rule (plain-id . xs)
(plain #:dir dir . xs))
(define (copyfile-id source [target #f])
(copyfile-resource source target #:dir dir))
(define (symlink-id source [target #f])
(symlink-resource source target #:dir dir))
provides)))]))
(define-syntax (define+provide-context stx)
(make-define+provide-context stx #t))
(define-syntax (define-context stx)

View File

@ -13,14 +13,25 @@
(provide make-resource-files
navbar-style page-sizes font-family) ; needed for the blog template
(define (make-resource-files dir)
(define (make-resource-files dir robots.txt)
(define (copyfile file)
(copyfile-resource (in-here file) (web-path dir file)))
(define (writefile file contents)
(define (writefile file . contents)
(resource (web-path dir file) (file-writer output (list contents "\n"))))
`([logo ,(copyfile "logo.png")]
[icon ,(copyfile "plticon.ico")]
[style ,(writefile "plt.css" racket-style)]))
[style ,(writefile "plt.css" racket-style)]
[verification:google
@,writefile["google5b2dc47c0b1b15cb.html"]{
google-site-verification: google5b2dc47c0b1b15cb.html}]
[verification:bing
@,writefile["BingSiteAuth.xml"]{
<?xml version="1.0"?>
<users><user>140BE58EEC31CB97382E1016E21C405A</user></users>}]
[robots
;; #t (the default) => no-op file, good to avoid error-log lines
,(let ([t (if (eq? #t robots.txt) "User-agent: *\nDisallow:" robots.txt)])
(and t (writefile "robots.txt" t)))]))
(define page-sizes
@list{

View File

@ -1,6 +1,9 @@
#lang meta/web
(define-context "stubs/git")
(define-context "stubs/git"
#:robots.txt @list{User-agent: *
@(add-newlines (for/list ([d '(plt libs testing play)])
@list{Disallow: /@|d|/}))})
(provide git)
(define git
@ -27,11 +30,6 @@
@p{See the "brief", PLT-oriented @intro{introduction to git}.}}))
(define home-file @plain[#:file "home-text.html" home-text])
(define robots.txt
@plain{User-agent: *
@(add-newlines (for/list ([d '(plt libs testing play)])
@list{Disallow: /@|d|/}))})
(define gitweb-config
@plain[#:file "gitweb_config.perl"]{
our $projectroot = "repos";