Skip to content
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

Support layout and page title in same page? #5

Closed
jskeet opened this issue Jan 26, 2017 · 9 comments
Closed

Support layout and page title in same page? #5

jskeet opened this issue Jan 26, 2017 · 9 comments

Comments

@jskeet
Copy link

jskeet commented Jan 26, 2017

I have two different layouts I need to support: one for the user guide, and one for a developer guide.

Ideally, I could default to the user guide but have a file in the developer directory that changes the layout. However, failing that, it wouldn't be awful to have:

@layout DeveloperLayout.md
@page title="Foo"

in each developer guide page. But at the moment, I think only a single directive is supported per file. Perhaps it should read a line at a time until it finds something which isn't a directive (and processing the directives as it goes), and then concatenate the rest of the file with that...

@jskeet
Copy link
Author

jskeet commented Jan 26, 2017

Ooh, it looks like I can put a _ViewStart.md in each view directory, and that will be picked up. That will be a fine solution for me...

@jskeet
Copy link
Author

jskeet commented Jan 26, 2017

Nope, that doesn't work - I've tried a few things, and although a single _ViewStart.md with @layout _Layout looks like it might work, I don't see any way of specifying a layout relative to the page itself.
I think I can make do with two controllers, although it's a bit ugly...

@hishamco
Copy link
Owner

@jskeet I change the directives little bit last week but I didn't push the updates yet, hope I will do it soon.
Regarding _ViewStart it is limited now so the engine only able to pick it from the shared folder

@hishamco
Copy link
Owner

Uploading the latest change will fix the issue. Also I will look to support multiple _ViewStart so you will be able to add one in each folder

@jskeet
Copy link
Author

jskeet commented Jan 26, 2017

RIghto - will use different controllers just for now, but fix it later - thanks :)

@jskeet
Copy link
Author

jskeet commented Jan 26, 2017

No need for multiple _ViewStart in this particular case, so long as there's a way of making a single @layout directive work relative to the rendered Markdown page - I can just call the layout _Layout.md in every directory.

@hishamco
Copy link
Owner

Yes you can, but it's tedious 😄, we can support _ViewStart per folder such as Razor Engine

@hishamco
Copy link
Owner

After looking to the latest code the @page directive introduces a property called Layout instead of the @Layout directive, so this absolutely will solve your issue

@hishamco
Copy link
Owner

hishamco commented Jan 27, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants