Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Customizing page header #146

Open
Amy-Lynn opened this issue Dec 27, 2018 · 2 comments
Open

Customizing page header #146

Amy-Lynn opened this issue Dec 27, 2018 · 2 comments

Comments

@Amy-Lynn
Copy link

I'm new to Hexo and hexo-theme-doc, so there may be something I'm missing here.

I'm migrating a bunch of docs from a different markdown doc solution. I previously already had each page tagged with some metadata (including title). Rather than defining the page title twice (once as metadata and manually typing it out at the top of the page, I'd like the customize the page layout to automatically put the title in an <h1> tag (along with displaying some other metadata I have defined, like audience and description).

I think I really just want https://github.com/zalando-incubator/hexo-theme-doc/blob/master/layout/page.ejs#L6 to be

      <div id="page-content" class="doc-formatting">
        <h1><%- page.title%></h1>
        <hr/>
        <%- page.content %>
        <div id="react-support-footer-root"></div>
      </div>

Is there an existing way to do this?

Happy to submit a PR (defining a partial there that people could insert?), but wanted to confirm the approach.

Thanks!

@rbarilani
Copy link
Contributor

@Amy-Lynn Yep can definitely be done but it should be an opt-in to don't introduce a breaking-change.
You can use an option that can be provided by the user in the configuration file.

Something like...

theme_config:
   auto_page_title: true # default to false

WDYT?

I will be happy to see a PR implementing it!

BTW I will just use a simple <h1> without <hr>.

@rbarilani
Copy link
Contributor

Or maybe we can use the project_partial functionality so a user as you will be able to introduce a custom template for the start of the page, in this way it will be more flexible.

See how the helper is used here in the layout.

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

No branches or pull requests

2 participants