I want to add a favicon to my website which is built with scribble, but when I put something like
(make-head-extra ...) into my scribble file, it tells me that:
not valid in document body (need a pre-part for decode) in: (head-extra...)
Anyone knows the way to use it? I failed to find an example from the official docs.
The idea is that
head-extra structures can be used in styles.
Here is an example:
(define (add-defaults doc pfx styl extras version?
#:html [html #f]
#:properties [properties null])
[style (make-style (style-name (part-style doc))
; Add <script>...</script> to the <head>...</head> portion of html.
(append (style-properties (part-style doc)) ; existing styles
; --- MathJax support ---
(head-extra ; This loads MathJax from mathjax-source
(head-extra ; This loads the given extensions.
`(script ([type "text/x-mathjax-config"]) ,extentions)))))]))
Thanks, but where should I place this function and when/how to call it?
The function above was just meant to illustrate that
head-extra is used with
So something like this:
(make-style (head-extra ...))
Oh, thank you, I made it:
(define favicon (make-style
'(link ([rel "shortcut icon"]
The last problem is that I should associate the style with every section to make all pages (each section a page) have that favicon. It there a way to write it only once and apply it to every page?
You can make a new file "utils.rkt" and export your own versions and then
@(require "utils.rkt") in your scriible file:
Something like this (untested)
(provide (rename-out [my-title title]))
(define (my-title #:tag [tag #f] #:tag-prefix [prefix #f] #:style [style favicon]
#:version [version #f] #:date [date #f]
'( #:date #:tag #:tag-prefix #:style #:version)
(list date tag prefix style version)
I got the template for the my-title here: