-
Notifications
You must be signed in to change notification settings - Fork 410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What if I don't want $partial("templates/post-list.html")$ to be in index.html? #807
Comments
Hi 👋 I'm new to
You now have to make the But now, you're facing an issue : by default you apply One solution would be to have two "default" templates, one in general and one for the posts. In my humble opinion, you don't want your posts to be displayed in every single page of your site. EDIT: your -> you're |
Ah I see what you mean. I mean it's more a general question about how generating a list of things in a template. But yeah it seems like something that might be hard to implement. I'll put it on the back burner until I'm more adept with Ha[ske/k]ll. Thanks for your help! |
Well, it depends on what you really want. Here, you try to generate a bunch of content base on your posts and I guess this page will help you understand how to deal with But yeah, generating customListField :: String -> String -> Context a
customListField key custom = listFieldWith key (field custom $ return . itemBody) customListField'
where
customListField' :: Item b -> Compiler [Item String]
customListField' item = do
metadata <- getMetadata $ itemIdentifier item
let customs = fromMaybe [] $
(lookupStringList key metadata) `mplus`
(map trim . splitAll "," <$> lookupString key metadata)
mapM makeItem customs This will look at an For example adding
So if you have foo:
- a
- b
- c or foo: a, b, c The |
This is probably quite an obvious question so apologies in advance.
Suppose I'm working with the example site and I decide I would like the the list of posts to be generated in a template. If I move the the line
$partial("templates/post-list.html")$
into, say,templates/default.html
so the header there now looks like this:I'll get the following error when I try to rebuild the site
I'm a little stuck on what I do to resolve this. Any help much appreciated!
The text was updated successfully, but these errors were encountered: