Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed 'base' -> 'root'.

  • Loading branch information...
commit 36ca4074b41d309ce0faba66f7bb83bfede835ce 1 parent c83e054
@jgm authored
Showing with 10 additions and 9 deletions.
  1. +5 −4 README.markdown
  2. +2 −2 Yst/Render.hs
  3. +3 −3 demo/layout.html.st
View
9 README.markdown
@@ -480,10 +480,11 @@ are rendered:
- `$gendate$`: the date the page was generated
- `$sitetitle$`: the site title from `config.yaml`
- `$pagetitle$`: the page title as defined in `index.yaml`
-- `$base$`: the path to the website's base directory, relative to the
- page being rendered (put this in front of urls for css and javascript
- in the layout file, so that these resources can be found even when
- you're in a subdirectory of the site)
+- `$root$`: the path to the website's root, relative to the page being
+ rendered. So, for example, if we are rendering `rooms/room503.html`,
+ `$root$` will have the value `../`. Put `$root$` in front of relative URLs
+ in your layout file, so that the links aren't broken on pages in
+ subdirectories.
### Previewing a site
View
4 Yst/Render.hs
@@ -112,7 +112,7 @@ renderPage site page = do
layoutTempl <- getTemplate layout g
let format = formatFromExtension (stripStExt layout)
let contents = converterForFormat format rawContents
- let base' = case length (filter (=='/') $ pageUrl page) of
+ let root' = case length (filter (=='/') $ pageUrl page) of
0 -> ""
n -> concat $ replicate n "../"
return $ render
@@ -120,7 +120,7 @@ renderPage site page = do
. setAttribute "pagetitle" (pageTitle page)
. setAttribute "gendate" todaysDate
. setAttribute "contents" contents
- . setAttribute "base" base'
+ . setAttribute "root" root'
. setAttribute "nav" menuHtml
$ layoutTempl
View
6 demo/layout.html.st
@@ -2,10 +2,10 @@
<head>
<title>$sitetitle$ - $pagetitle$</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <link rel="stylesheet" type="text/css" href="$base$css/screen.css" />
- <link rel="stylesheet" type="text/css" media="print" href="$base$css/print.css" />
+ <link rel="stylesheet" type="text/css" href="$root$css/screen.css" />
+ <link rel="stylesheet" type="text/css" media="print" href="$root$css/print.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
- <script src="$base$js/nav.js" type="text/javascript"></script>
+ <script src="$root$js/nav.js" type="text/javascript"></script>
</head>
<body>
<div id="doc3" class="yui-t1">
Please sign in to comment.
Something went wrong with that request. Please try again.