-
Notifications
You must be signed in to change notification settings - Fork 342
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
"Dynamic pages" from metadata and a layout #217
Comments
So to be clear, this is nearly possible now.
class1.jade
class2.jade
_template.jade
|
Well the way I do it right now is that I just make empty files: _data.json{
"class1": {
"name": "Class1",
"description": "Lorem ipsum"
},
"class2": {
"name": "Class1",
"description": "Lorem ipsum"
}
} _layout.jade
class1.jade
class2.jade
The only change would be that Harp would no longer need a file per page, so that using just the metadata would be possible. |
I am having the same issue for pagination and tags in my blog. I am creating empty files called |
We’ve definitely been hearing that from people and it’s something we’d like to see added. I don’t think there’s any timeline on it unless someone would like to help contribute, though. In the meantime, one option would be to output all 100 items (or however many) on one page, and dynamically paginate client-side. This is a little unconventional, but still worth looking into, I think. |
👍 Basically, I have I thought about creating a Any idea how to workaround it ?
|
👍 we're currently looking into static site generators and would love this feature. For now, to achieve this functionality, our group is probably just going to use Jekyll and hook into their custom generator during the build process. I would LOVE to see this as a feature in Harp |
@kennethormandy @archseer I wouldn't mind trying to contribute and adding this functionality, but not sure how we would specify to output specific files. For instance should there be additional syntax on the Some optional field like 'createStatic: jade' on each section in the data ?
Maybe some optional compile flag , but then we'd need some additional way (config file) , to specify what specific data should output a new static file. Or what would be a good way to have the user specify that they want the static file created on the fly? |
@jxm262 @kennethormandy @archseer I love this idea, and I think there might be an easy-ish way of implementing it. In the parent folder of the location of the page in use, you could have an _dynamic folder. So, if you wanted to have the page:
you create the folder:
and then inside that folder you would have the following files:
thoughts? |
Is there any possible workaround for this? |
+1, I also have to create empty pages as a workaround for this - which is really counter-intuitive. Now if only we could add metadata (JSON) as pages, like Wintersmith enables you to. For me this would be a great start, and in my case it would be better to have seperate json files than one big data.json. Is this something that would be easy to implement? |
+1 |
I agree that some important use cases would be enabled by page generation from metadata (per-tag pages, paginated indexes). It's hard to come up with a design that fits with Harp. It's still a bit fuzzy, but I think I have a design that could work, without adding too much API surface area. The idea is to introduce a
I'd be up for working on an implementation of this. It would need good test coverage to make sure it works as expected and doesn't overwrite anything important/escape the output dir/etc. @sintaxi @kennethormandy what do you think? |
Any news on this? I love harp js, but this is really its weak point, and such a basic functionality of other frameworks |
Based on my IRC discussion with @silentrob, I have a quick feature request. I'm writing documentation for code, and my custom parser basically produces JSON hashes right now. So my idea was, since all of the pages have exactly the same layout, that I would create a
_layout.jade
file containing all of the layout (and no yield), and simply export all of the content into_data.json
, essentially creating "dynamic" pages without their separate page files -- Instead of using the metadata to add to .jade pages, I'd use that metadata to create a page.This is an example of that usage:
_data.json
_layout.jade
This would make two pages accessible,
/class1
and/class2
.The way Harp currently works is that each page needs it's own file, or else it 404's, so I'm circumventing that by simply creating empty
.jade
files for all of these pages, but I would love to be able to skip this in the future.The text was updated successfully, but these errors were encountered: