You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+27-2
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,16 @@ Documentation can be found at <https://hexdocs.pm/tableau>.
31
31
32
32
The examples in the README use the [Temple](https://github.com/mhanberg/temple) library to demonstrate that Tableau can be used with any markup language of your choice. You could easily use the builtin EEx, or use HEEx, Surface, or HAML.
33
33
34
+
### Layouts
35
+
36
+
Layouts are modules that use the `use Tableau.Layout` macro.
37
+
38
+
Layouts have assess to the `@site` and `@page` assign.
39
+
40
+
The `@site` assign contains your site's config.
41
+
42
+
The `@page` assign contains all the options passed to the `use Tableau.Page` macro.
43
+
34
44
```elixir
35
45
defmoduleMySite.RootLayoutdo
36
46
useTableau.Layout
@@ -47,6 +57,10 @@ defmodule MySite.RootLayout do
47
57
meta http_equiv:"X-UA-Compatible", content:"IE=edge"
48
58
meta name:"viewport", content:"width=device-width, initial-scale=1.0"
49
59
60
+
title do
61
+
@page.some_assign
62
+
end
63
+
50
64
link rel:"stylesheet", href:"/css/site.css"
51
65
end
52
66
@@ -77,11 +91,21 @@ end
77
91
78
92
#### Page
79
93
94
+
Pages are modules that use the `use Tableau.Page` macro.
95
+
96
+
Required options:
97
+
98
+
*`:layout` - which layout module to use.
99
+
*`:permalink` - the permalink of the page
100
+
101
+
Any remaining options are arbitrary and will be available under the `@page` assign available to layout and page templates.
102
+
80
103
```elixir
81
104
defmoduleMySite.AboutPagedo
82
105
useTableau.Page,
83
106
layout:MySite.RootLayout,
84
-
permalink:"/about"
107
+
permalink:"/about",
108
+
some_assign:"foo"
85
109
86
110
importTemple
87
111
@@ -186,7 +210,8 @@ Other static assets can be copied into the "out" directory by placing them in an
0 commit comments