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

Hide edit button and title on specified pages #2163

Closed
Kanaduchi opened this issue Dec 30, 2020 · 5 comments
Closed

Hide edit button and title on specified pages #2163

Kanaduchi opened this issue Dec 30, 2020 · 5 comments

Comments

@Kanaduchi
Copy link

Kanaduchi commented Dec 30, 2020

  • [/] I've read the [contribution guidelines][1] and agree with them

I want to suggest an idea and checked that ...

  • [/] ... to my best knowledge, my idea wouldn't break something for other users
  • [/] ... the documentation does not mention anything about my idea
  • [/] ... there are no open or closed issues that are related to my idea

Description

In some cases it will be a great deal to hide page title and edit button on specific pages.

Example:

---
hide:
  - pageTitle
  - editButton
--- 
@squidfunk
Copy link
Owner

Why? Could you elaborate on why one would want to do that? Also what do you mean by page title?

@Kanaduchi
Copy link
Author

On some pages, e.g. on main pages I don't need any header and edit button.

Currently to hide header I add empty H1.
But is not good case because I still have big empty line at the top of the page:
empty header

@squidfunk
Copy link
Owner

squidfunk commented Dec 31, 2020

Providing an option for these kinds of tweaks is out-of-scope for this project – we just cannot make everything configurable. Hiding the sidebars involves some more complex logic, which is why these are provided as options. You can hide the headline and edit button with some inline CSS. Just add this to the Markdown file in question:

<style>
  .md-typeset h1,
  .md-content__button {
    display: none;
  }
</style>

If you want to do this for multiple pages, use the "site-wide glossary" approach by leveraging the Snippets extension:
https://squidfunk.github.io/mkdocs-material/reference/abbreviations/#adding-a-glossary

@Kanaduchi
Copy link
Author

@squidfunk inline css works like magic! Thank you!

@shenweiyan
Copy link

I found that using this inline CSS method also results in the hiding of the h1 titles in the search results of the current page.

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

3 participants