Skip to content

Commit

Permalink
fix: broken layouts (#1060)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang authored Aug 22, 2024
1 parent 296edcc commit 4438926
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 51 deletions.
22 changes: 17 additions & 5 deletions assets/main/scss/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,28 @@
}
}

main {
main.sidebar {
&.sidebar-none {
.sidebar {
display: none !important;
}

.content {
> div:first-of-type {
width: 100%!important;
}
.content-posts {
@extend .col-xxl-12;
}

.content-docs {
@extend .col-xxl-10;
}
}


&:not(.sidebar-none) {
.content-docs {
@extend .col-xxl-7;
}
.content-posts {
@extend .col-xxl-8;
}
}
}
14 changes: 0 additions & 14 deletions exampleSite/content/docs/content/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,6 @@ And the append `type = "docs"` on the front matter of `archetypes/notes.md`. Now

Similarly, you can also custom the archetypes for `posts`, `docs` and so on.

## Sections Template

You may also want to use the same list layout of `docs` on `notes`.

```html {title="layouts/notes/list.html"}
{{ define "content" }}
{{- partial "docs/nav" . -}}
<div class="col ms-auto">
{{ partial "docs/list" . }}
</div>
{{- partial "docs/sidebar" . -}}
{{ end }}
```

## Write New Articles

> Suppose the default language is `en`.
Expand Down
14 changes: 0 additions & 14 deletions exampleSite/content/docs/content/index.zh-hans.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,6 @@ $ cp themes/hugo-theme-bootstrap/archetypes/default.md archetypes/notes.md

同样地,你也可以为 `posts`、`docs` 等自定义原型。

## Sections 模板

你可能还想在 `notes` 中使用和 `docs` 一样的列表布局。

```html {title="layouts/notes/list.html"}
{{ define "content" }}
{{- partial "docs/nav" . -}}
<div class="col ms-auto">
{{ partial "docs/list" . }}
</div>
{{- partial "docs/sidebar" . -}}
{{ end }}
```

## 书写文章

> 假设默认语言为 `en`。
Expand Down
14 changes: 0 additions & 14 deletions exampleSite/content/docs/content/index.zh-hant.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,6 @@ $ cp themes/hugo-theme-bootstrap/archetypes/default.md archetypes/notes.md

同樣地,你也可以為 `posts`、`docs` 等自定義原型。

## Sections 模板

你可能還想在 `notes` 中使用和 `docs` 一樣的列表布局。

```html {title="layouts/notes/list.html"}
{{ define "content" }}
{{- partial "docs/nav" . -}}
<div class="col ms-auto">
{{ partial "docs/list" . }}
</div>
{{- partial "docs/sidebar" . -}}
{{ end }}
```

## 書寫文章

> 假設默認語言為 `en`。
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ define "content" }}
<div class="{{ if default true .Params.sidebar }}col-xxl-8{{ else }}col-xxl-12{{ end }}">
<div class="content-posts {{ if default true .Params.sidebar }}col-xxl-8{{ else }}col-xxl-12{{ end }}">
<div class="container">
{{- partial "breadcrumb" . -}}
{{- partial "post" . -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/docs/single.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ define "content" }}
{{- partial "docs/nav" . -}}
<div class="col ms-auto">
<div class="col ms-auto content-docs">
<div class="container-fluid">
{{- partial "breadcrumb" . -}}
{{- partial "docs/post" . -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/landing/single.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ define "content" }}
<div class="{{ if default true .Params.sidebar }}col-xxl-8{{ else }}col-xxl-12{{ end }}">
<div class="content-posts {{ if default true .Params.sidebar }}col-xxl-8{{ else }}col-xxl-12{{ end }}">
{{ .Content }}
</div>
{{- partial "sidebar" . }}
Expand Down
6 changes: 5 additions & 1 deletion layouts/partials/functions/container-class.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
{{- $fullWidth := partialCached "functions/full-width" .FirstSection }}
{{- return cond $fullWidth "container-fluid" "container" -}}
{{- $class := "" }}
{{- if default true .Params.sidebar }}
{{- $class = "sidebar" }}
{{- end }}
{{- return (cond $fullWidth "container-fluid" "container" | printf "%s %s" $class ) -}}

0 comments on commit 4438926

Please sign in to comment.