-
Notifications
You must be signed in to change notification settings - Fork 49
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
Breadcrumb navigation #200
Comments
Yes I agree, this would be usefull for my project as well! I might want to try and develop this feature, should this be a plugin or can this be a core feature? |
I've got it working: https://github.com/ndelangen/sourcejs-Source/tree/ndelangen/breadcrumb-in-header But I need feedback from @operatino whether this is as he envisioned such a feature. I've added this via the wrap.js middleware in core. |
It would be better to use the meta data in info.json file and display title rather than a friendly file name. |
Good point! I'll give it some thought on how to display the info.json names. Regarding styling not working, I think you need to run |
Hi, I totally like the idea with having breadcrumbs in the core. We were discussing it before with our team, had same requests before. Looking forward to your contribution! Will be glad to help with making this work. Some initial thoughts about the implementation:
Regarding the note from Gitter:
We'll move all the templates to use EJS and render on server side mostly, in case where it really be require to render client side as well, it will be still EJS with same data sets. But anyway, header and footer that are in some cases injected on client side is a legacy thing, which will be removed from the core. This problem will be also less relevant, when we'll prepare whole HTML on the server, and fill in |
I'll refactor and submit a PR. 👍 |
I've been refactoring, but I've not been able to make it work so far, I'll need some help @operatino . I updated my feature-branch. It's broken at this stage. What I think is going on: the same EJS-template is attempted to be rendered, once with part A of the data (head, header, footer), and a second time with breadcrumbs. But the first time EJS exits with an error: It cannot resolve 'breadcrumb'.
Is there some option for EJS to ignore parts that it cannot resolve? And have it render the output of the earlier render with new data? I doubt this is intended use of EJS. If you see some way of making this work, that be awesome! |
Hi, @ndelangen! I'll check what's going on with your version, seems like some small bit is missing to make whole thing running. Regarding checks in EJS for data that may not exist, you can just do |
Does, making the error go away like that, solve the problem though? Since the template has already been provided with data once and rendered, I'm assuming all the EJS tags are removed/replaced? Thus a second iteration would not template/change anything, and breadcrumbs would simple not be shown? |
Ah I see, the ejs spec templating is still done in wrap.js, but wrap.js is provided with additional data from the breadcrumb middleware. I have it working, will work on styling a bit tomorrow, and update the PR. Do you have a good idea how to retrieve a spec's title, based on URL @operatino ? As @mackski suggests here, I'd be nice to display the real title instead of just the url-fragment. Is there some sitemap already generated somewhere? If not, that could be useful to make? |
@ndelangen The recommended way is to always set Spec Title in the In your middleware, you can fetch Spec Info with https://github.com/sourcejs/Source/blob/0.6.0-dev/core/lib/specUtils.js#L56, and use human readable title instead of URL. Same goes for parent folders/catalogs. |
Looks cool! I'll give it a review as fast as possible. |
Ndelangen/breadcrumb: add breadcrumb navigation #200
Done 1f3b006 |
Thanks for including the breadcrumbs to the project. Is there an "getting started" or an example how to use it in the specs? |
@mspkom, you need to update the |
Thanks so far, but I think, I still have a problem with the version. Installing or updating it with yo, I still have the version 0.4.2 on my computer. I guess, that is the problem. |
Yes, you should have The old project structure, when user folder is a child of SourceJS will be deprecated in 0.6.0, and dropped with 0.7 release. |
Thanks a lot for the good and fast support. You guys do really great work. |
Glad to hear the breadcrumbs are liked! |
Breadcrumbs would be good for deeper navigation without having to back in browser or start from spec homepage again.
The text was updated successfully, but these errors were encountered: