yst icon indicating copy to clipboard operation
yst copied to clipboard

How can one implement dynamic pages. [feature request][discussion]

Open karanahuja-android opened this issue 8 years ago • 4 comments

In the demo example - what do we do if we need to implement an event detail page. for each event - if we need an event detail page - do we create each page in index.yaml ?

for 1000's of events - this could be a pain area.

example for event data - we have some more fields that need to be shown on event detail page.

  • date:
    • 2009-04-20
    • 2009-04-22 speaker:karan id:10 title: Seminar on web security videos: list of attendees:

and the event detail pages will be as :

events.html/9 events.html/10 events.html/11 events.html/12

and so on.

I am not stuck on this right away, but soon this could come up to work on for my site. so discussing ways to implement dynamic pages would be great.

maybe we add queryparam to fetch the params from the data. and then for each param the page is generated.

karanahuja-android avatar Feb 22 '17 10:02 karanahuja-android

yst is designed to generate the content of a page based on data; it isn't designed to generate the pages themselves based on data as in your example.

I can see how this would be useful, and yst could be changed in this way, but I'm not likely to do it myself, and you might be better off using a more flexible tool like Hakyll.

+++ karan-ta [Feb 22 17 02:24 ]:

In the demo example - what do we do if we need to implement an event detail page. for each event - if we need an event detail page - do we create each page in index.yaml ?

for 1000's of events - this could be a pain area.

example for event data - we have some more fields that need to be shown on event detail page. * date: + 2009-04-20 + 2009-04-22 speaker:karan id:10 title: Seminar on web security videos: list of attendees: __________________________________________________________________

and the event detail pages will be as :

events.html/9 events.html/10 events.html/11 events.html/12

and so on.

I am not stuck on this right away, but soon this could come up to work on for my site. so discussing ways to implement dynamic pages would be great.

maybe we add queryparam to fetch the params from the data. and then for each param the page is generated.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, [1]view it on GitHub, or [2]mute the thread.

References

  1. https://github.com/jgm/yst/issues/49
  2. https://github.com/notifications/unsubscribe-auth/AAAL5AQ8g8mcH22MmdT4fA8WL4CIiv7jks5rfAzJgaJpZM4MIdOp

jgm avatar Feb 22 '17 13:02 jgm

Thank you john for fast and clear reply. i wonder if i will be able to understand hakyll as easily as i got into yst. i came to yst from the hakyll docs and saw the raw simplicity of yst which is appealing. i have made good progress with my site with yst yesterday and today. so for now i shall stick with yst.

I shall see if i can add this feature when i urgently need it.

i came across one more similar case of this type of feature need.

suppose i have a list of topics. and each topic has a list of links. and i want a display such as : topic 1 link1 of topic 1 link2 of topic 2 link 3 of topic 3

topic 2 link1 of topic 2 link2 of topic 2 link 3 of topic 2

then my yaml starts becoming kinda long as follows suppose the topics are philosophy, business, haskell, conrod,rust.

data : topics : FROM topics.yaml ORDER BY position philosophylinks : FROM philosophy.yaml ORDER BY step LIMIT 5 businesslinks : FROM business.yaml ORDER BY step LIMIT 5 haskelllinks : FROM haskell.yaml ORDER BY step LIMIT 5 metalearninglinks : FROM metalearning.yaml ORDER BY step LIMIT 5 conrodlinks : FROM conrod.yaml ORDER BY step LIMIT 5 rustlinks : FROM rust.yaml ORDER BY step LIMIT 5

and so on....

so a generator template / macro could be the answer for this too.

so i shall study hakyll and other solutions to try and implement this when my data starts getting bigger.

so maybe this issue can remain open for now for future refrence :) or if you like - i can close it from here - as you wish.

karanahuja-android avatar Feb 22 '17 14:02 karanahuja-android

You could always have a program generate your index.yaml.

jgm avatar Feb 22 '17 15:02 jgm

+1 yes exactly. This could also be useful for pagination use case.

karanahuja-android avatar Mar 27 '17 10:03 karanahuja-android