Skip to content

Commit

Permalink
✨ Add simple page layout for full-width content
Browse files Browse the repository at this point in the history
Fixes #139
  • Loading branch information
jpanther committed Mar 7, 2022
1 parent 74677d9 commit c185771
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

### Added

- Simple page layout for creating full-width content ([#139](https://github.com/jpanther/congo/issues/139))
- Portuguese (Portugal) translation ([#144](https://github.com/jpanther/congo/pull/144))

### Changed
Expand Down
22 changes: 22 additions & 0 deletions exampleSite/content/docs/content-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,28 @@ The theme includes an archetype to make generating these external link articles
hugo new -k external posts/my-post.md
```

### Simple pages

| | |
| ----------------- | ------------------------------ |
| **Layout:** | `layouts/_default/simple.html` |
| **Front Matter:** | `layout: "simple"` |

Congo also includes a special layout for simple pages. The simple layout is a full-width template that just places Markdown content into the page without any special theme features.

The only features available in the simple layout are breadcrumbs and sharing links. However, the behaviour of these can still be controlled using the normal page [front matter]({{< ref "front-matter" >}}) variables.

To enable the simple layout on a particular page, add the `layout` front matter variable with a value of `"simple"`:

```yaml
---
title: "My landing page"
date: 2022-03-08
layout: "simple"
---
This page content is now full-width.
```

## Custom layouts

One of the benefits of Hugo is that it makes it easy to create custom layouts for the whole site, individual sections or pages.
Expand Down
18 changes: 18 additions & 0 deletions layouts/_default/simple.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{ define "main" }}
<article class="max-w-full">
<header>
{{ if .Site.Params.article.showBreadcrumbs | default false }}
{{ partial "breadcrumbs.html" . }}
{{ end }}
<h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">
{{ .Title | emojify }}
</h1>
</header>
<section class="max-w-full mt-6 prose dark:prose-invert">
{{ .Content | emojify }}
</section>
<footer class="pt-8">
{{ partial "sharing-links.html" . }}
</footer>
</article>
{{ end }}

0 comments on commit c185771

Please sign in to comment.