Open GeorgeBerdovskiy opened 7 months ago
Two notes -
For example, the starter code is pretty sloppy. Is there a more idiomatic way to achieve the same result? What about "index" pages - should the title be "Index" or something else?
I can do this one, it’s not that complicated and is interesting
Could you assign me this task?
Yepp it's all yours @sohamnair, I added the Claimed
label just now!
Background
Right now, we only have one level of pages on our documentation site. In other words, there are no subpages or nested pages. For better organization, we'd like to add them! You can find nested pages on many documentation sites, such as the Next.JS docs (here).
As you can see in the above screenshots, there is a "Routing" page, but there are also many pages associated with "Routing" that appear below, such as "Defining Routes."
Goal
We want to add nested pages to the PureChart documentation site (here). However, this issue doesn't involve any HTML/CSS, but rather the generation of a nested "navigation tree" that we can use to generate the HTML/CSS later (issue #1 creates the nested buttons and another issue will combine these two together).
Guidance
Take a look at the
app
folder of this repository - you should find amarkdown
folder with several Markdown files. When a user presses one of the navigation buttons, a request is sent to the controller to display the corresponding page. It does this by matching the route name to the Markdown file name, parsing its contents into HTML, and then displaying that HTML. The code that achieves this is inapp/controllers/articles_controller.rb
-To support nested navigation, we'll need to adjust the way files are stored. Instead of storing each page as its own
.md
file, every page should be a folder with at least anindex.md
inside, and possibly other folders inside for subpages.Your updated controller code may look something like this. Ignore the excessive
puts
calls - those are for some rough debugging to confirm our code is correct.This results in a "navigation tree" that sort of looks like this...