Skip to content

feat: support custom homepage #304

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

Closed
wants to merge 1 commit into from
Closed

feat: support custom homepage #304

wants to merge 1 commit into from

Conversation

ulivz
Copy link
Member

@ulivz ulivz commented Apr 30, 2018

Background

Yesterday, I thought a log about the Custom Homepage before closing a issue (#294). anyhow, we should NEVER use v-html to render anything from front-matter —— The YAML is only meant for convenience, and you even cannot use multiple line syntax.

BTW, Another defect of using html at front-matter is that we will need to parse each field which would be html. in fact, we only need to support HTML for description in homepage. while in other page the description in only existed in <meta> tag.

@luisDanielRoviraContreras Thanks for your PR, as Evan said at #293 (comment), we can simply inspect the default generated structure and write your own HTML in the markdown section:

<div class="hero">
  <img src="/hero.png" alt="hero">
  <h1>VuePress</h1>
  <p class="description">
      Vue-powered Static Site Generator
  </p>
  <p class="action"><a href="/guide/" class="nav-link action-button">Get Started →</a></p>
</div>

It's a good idea, but I still want to keep some custom functionalities out of the box. which is for a more smooth transition to pure html or Custom Layout.

So with this PR, you can implement your requirements like this:

---
home: custom
# ... other front-matters
---

<Home>

  <slot slot="title">
    <b>Vuesax</b> Frontend Vue Components
  </slot>
  
  <slot slot="description">
    We love what we do. Let us help you do what <b>You love.</b>
  </slot>

  // ... additional content
  
</Home>

You can use multiple line syntax, router links, Vue components etc.

@yyx990803 This feature only import very small change to the core. and fully downward compatibility. please help me to confirm the document. thanks!

@ulivz
Copy link
Member Author

ulivz commented May 10, 2018

Closing this PR since it will make core complex, If you want to custom homepage, just use custom layout.

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

Successfully merging this pull request may close these issues.

1 participant