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

Changing home to About instead of All Posts #153

Open
adrianauscanga opened this issue Jun 6, 2023 · 2 comments
Open

Changing home to About instead of All Posts #153

adrianauscanga opened this issue Jun 6, 2023 · 2 comments

Comments

@adrianauscanga
Copy link

Hi! Thank you for creating this theme. I'm using your theme for my personal website. I would like the home page to be my About page instead of my blog Posts but I can't find where to change that. I was wondering if it's possible to modify that and if so, would you point me to the right direction?
Thank you very much!

Adriana

@zhaohuabing
Copy link
Owner

zhaohuabing commented Jun 7, 2023

It's a bit tricky but Hugo actually allows you to override the default index page.

#create a layout directory in the root of your blog source code if you don't have one
mkdir layout
# copy the default index page to the layout directory we just created
cp themes/hugo-theme-cleanwhite/layouts/index.html layouts/index.html

Then modify the content of the index.html to include your about page. The below example is based on my web site, so you 'll need to adjust a little bit to suite yours.

{{ define "main" }}
  <!-- Post Content -->
<article>
  <div class="container">
      <div class="row">
          <!-- Post Container -->
          <div class="
          col-lg-8 col-lg-offset-1
          col-md-8 col-md-offset-1
          col-sm-12
          col-xs-12
          post-container">
          {{$file :=  "/about/index-zh.md"}}   #link to your about page 
          {{ $file | readFile | markdownify}}
          {{ partial "comments.html" . }}
          </div>
          {{ partial "sidebar.html" . }}
      </div>
  </div>
</article>
{{ end }}

@adrianauscanga
Copy link
Author

adrianauscanga commented Jun 8, 2023 via email

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