-
Notifications
You must be signed in to change notification settings - Fork 64
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
add 'Edit Page' feature to doc pages #278
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great contribution @britneywright , thanks for doing this!
cls := "edit-button", | ||
a( | ||
href := config.gitSiteUrl, | ||
href := "/edit/master/modules/docs/src/main/tut/{{ page.path }}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can set up this "baseUrl" (the modules/docs/src/main/tut
piece) to a new setting, for example, in the sbt-microsites case, this would be something like this:
/edit/master/docs/src/main/tut/docs/{{ page.path }}
Hence, my suggestion would be creating a product (EditButtonSettings
) for the new sbt setting:
micrositeEditButton: SettingKey[Option[EditButtonSettings]]
// ... and
case class EditButtonSettings(text: String, baseDocsPath: String)
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's a good idea. i was debating if I should make that go to the edit view of the page or not, this way users could decide for themselves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah and yes I realized I was basing my path off a project with modules, so the path could vary depending on that as well.
Added a suggestion to improve the new setting
8e46540
to
be306ca
Compare
@juanpedromoreno Let me know what you think of this update. So now in a project the setting would be something |
Thanks @britneywright , great contribution! I think there are some minor failures in the unit tests, but the code and docs look good to me. Once fixed, I'll merge it and I'll release a new patch version :) |
LGTM, thanks! |
I think this double-href introduces a space after the |
Actually, yes... this is what I'm seeing generated: <a href="https://github.com/sritchie/scala-rl /edit/develop/docs/src/main/tut/course/tabular/bandits.md" class="btn-sm btn-info">Improve this Page</a> |
@sritchie Not seeing what you're seeing. Here's what's generated in the project I work on: https://github.com/vinyldns/vinyldns/blob/gh-pages/api/approve-batchchange.html#L195 And here's our config setting: https://github.com/vinyldns/vinyldns/blob/master/build.sbt#L413-L415 Do you have a link to your project if you want some help? |
Hey @britneywright, the issue only appeared in 0.9.3 with some version upgrades. Looks like I chose the lucky version. Some guesses about the cause showed up here: #323 And I can confirm that this fixed it: #324 Thanks! |
for #96
I added a configuration setting named
micrositeEditButtonText
. By default it's set to None and the button is not visible. If it's set to Some with a string a button will appear at the bottom of pages with the DocsLayout. The button will have the text of the given string and link to the edit view of the page in the project repository.For example for the page https://www.vinyldns.io/api/create-zone.html the button would link to https://github.com/VinylDNS/vinyldns/edit/master/modules/docs/src/main/tut/api/create-zone.md
Desktop view:
Mobile view.