Hi all!
I’m currently re-building my portfolio (and learning middleman along the way to simplify things) but having trouble setting up things exactly the way I want them. I’ve gone through all the docs and googled, but I just don’t getit / can’t really find the answer I’m looking for, so thought I’d try here:
This overall structure I want on my site:
-
A landing page, listing projects names as links from a json file.
-
A project page where I want to inject an image, project title and project description from json depending on which list item is clicked on the landing page.
These are the files I’m working with:
projects.json,
this is the data file from which I want to inject data into the sub pages.
{
"projects": {
"project_1": [
{"title":"Project 1",
"intro":"project intro",
"description":"project description"
}
],
"project_2": [
{"title":"Project 2",
"intro":"project intro",
"description":"project description"
}
]
}
}
project_titles.json,
this is the file from which I create the list on the index page.
{
"Projects": [
"Project 1",
"Project 2",
"Project 3"
]
}
index.html.erb,
this currently the landing page where all projects are listed from the json. No idea how to give these items a path to the corresponding sub page built with the proxy method…
Work
<% data.project_titles.project_titles.each do | title | %>
<%= title %>
<% end %>
- project_page.erb, layout file
- project_page.html.erb
These are the files I want to use as templates and with placeholder for the data to be injected, have no clue what do to here thought
Using the proxy method in config.rb, I’ve managed to build a sub page for each project in the json, but:
- How do I inject the corresponding content from json into each sub page during build?
- Also, how should I think in terms of the html structure for each sub page to inject the data?
Am I going about this the right way, or am I making it difficult for myself?
All help is greatly appreciated!
Cheers!