# Custom scribble site design

**URL:** <https://racket.discourse.group/t/custom-scribble-site-design/1674>\
**Category:** Questions & Answers\
**Tags:** scribble\
**Created:** [January 30, 2023, 10:06am UTC](https://racket.discourse.group/t/custom-scribble-site-design/1674 "2023-01-30T10:06:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![spdegabrielle](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/spdegabrielle/32/95_2.png) [@spdegabrielle](https://racket.discourse.group/u/spdegabrielle)\
**Post date:** [January 30, 2023, 10:06am UTC](https://racket.discourse.group/t/custom-scribble-site-design/1674/1 "2023-01-30T10:06:47Z")

</div>

Hi

I’d like to make a variant of `#lang scribble/manual` that has keeps the same site structure; table of contents page with individual chapter pages, but has a preamble followers by the table of contents as tiled images that link to the chapter/section pages. Like the plot cookbook but using scribble [https://github.com/Racket-Cookbooks/Plot-cookbook#plots](https://github.com/Racket-Cookbooks/Plot-cookbook#plots)

Any suggestions appreciated

Stephen

 ![image](https://global.discourse-cdn.com/free1/uploads/racket/original/1X/f9b19625da161a1098255fb4542abdb73a87777c.jpeg)

---

<div class="post-metadata">

**Author:** ![LiberalArtist](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/liberalartist/32/151_2.png) [@LiberalArtist](https://racket.discourse.group/u/LiberalArtist)\
**Post date:** [February 6, 2023, 8:31am UTC](https://racket.discourse.group/t/custom-scribble-site-design/1674/2 "2023-02-06T08:31:22Z")

</div>

It seems like you want something semantically similar to [`(table-of-contents)`](https://docs.racket-lang.org/scribble/base.html#%28def._%28%28lib._scribble%2Fbase..rkt%29._table-of-contents%29%29), but rendered differently. The implementation in `scribble/base` is:

```scheme
(define (table-of-contents)
  (make-delayed-block
   (lambda (renderer part ri)
     (send renderer table-of-contents part ri))))

```

… which is a bit obscure, especially because the `table-of-contents` method of [`render%`](https://docs.racket-lang.org/scribble/renderer.html#%28def._%28%28lib._scribble%2Fbase-render..rkt%29._render~25%29%29) is undocumented. Looking at its implementation, though:

> <https://github.com/racket/scribble/blob/89f5f59bc64e6954215f4a23a04c53b7e26ba246/scribble-lib/scribble/base-render.rkt#L1162-L1208>

it's not especially closely tied to being inside a `render<%>` class. The key piece is the call to [`part-collected-info`](https://docs.racket-lang.org/scribble/core.html#%28def._%28%28lib._scribble%2Fcore..rkt%29._part-collected-info%29%29) (back in the documented API), which gives you numbering and grouping information. Other than that, it's just manipulating [`part`](https://docs.racket-lang.org/scribble/core.html#%28def._%28%28lib._scribble%2Fcore..rkt%29._part%29%29) structures.

I'd probably start with a template using [`cond-block`](https://docs.racket-lang.org/scriblib/render-cond.html#%28form._%28%28lib._scriblib%2Frender-cond..rkt%29._cond-block%29%29) like this:

```scheme
(define (custom-table-of-contents)
  (cond-block
   [(not html)
    (table-of-contents)]
   [else
    (make-delayed-block
     (λ (renderer part ri)
       ??? (part-collected-info part ri) ???))]))

```

You could attach the images to the `part`s by defining a custom [style property](https://docs.racket-lang.org/scribble/core.html#%28part._style%29) and using it with `section`, `title`, etc., something like this:

```scheme
#lang scribble/manual
@(require scribble/core
          (only-in pict disk))
@(struct custom-toc-image (convertible)
   #:transparent)
@section[#:style (style #f (list (custom-toc-image (disk 100))))]{
 Disks
}

```
