-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from SPANDigital/PRSDM-6839
feat: PRSM-6839 add snippet output format for standalone/embeddable articles
- Loading branch information
Showing
8 changed files
with
105 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
COMING SOON . . . | ||
## 2025-01-21 | ||
### Feature | ||
- Add Snippet output for standalone articles in isolated contexts. @DustinFischer https://spandigital.atlassian.net/browse/PRSDM-7122 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,30 @@ | ||
# presidium-layouts-base | ||
Base Hugo layouts for Presidium | ||
|
||
## Custom Output Formats | ||
|
||
### Snippets | ||
|
||
The `Snippet` output format is a alternative HTML output format to the standard output (`index.html`) for _pages_ and _sections_. It's intended for generating standalone articles that can be used in third-party/isolated contexts (such as in an `iframe`). | ||
|
||
Features of a snippet: | ||
- Generates content from the `content/` directory. | ||
- Uses the same stylesheets as the standard output. | ||
- Excludes inter-host navigation contexts that are in the standard output, such as the toolbar and left sidebar. | ||
- Includes breadcrumbs to ancestor snippets for limited navigation within the docset. | ||
|
||
**Usage** | ||
|
||
Snippet outputs must be configured per docset repository in `config.yml`. | ||
|
||
```yaml | ||
# <my-docset>/config.yml | ||
... | ||
outputs: | ||
page: | ||
- html # -> index.html | ||
- snippet # -> snippet.html | ||
section: | ||
- html # -> index.html | ||
- snippet # -> snippet.html | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{{ define "scripts" }} | ||
{{ partial "common/dummy" . }} | ||
{{ end }} | ||
|
||
{{ define "toolbar" }} | ||
{{ partial "common/dummy" . }} | ||
{{ end }} | ||
|
||
{{ define "left-sidebar" }} | ||
{{ partial "common/dummy" . }} | ||
{{ end }} | ||
|
||
{{ define "breadcrumbs" }} | ||
{{ .Scratch.Set "output-format" "snippet" }} | ||
{{ partial "page/breadcrumbs" . }} | ||
{{ end }} | ||
|
||
{{ define "header" }} | ||
{{ .Scratch.Set "scope" "list" }} | ||
{{ partial "page/header" . }} | ||
{{ end }} | ||
|
||
{{ define "content" }} | ||
{{ partial "page/list" . }} | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{{ define "scripts" }} | ||
{{ partial "common/dummy" . }} | ||
{{ end }} | ||
|
||
{{ define "toolbar" }} | ||
{{ partial "common/dummy" . }} | ||
{{ end }} | ||
|
||
{{ define "left-sidebar" }} | ||
{{ partial "common/dummy" . }} | ||
{{ end }} | ||
|
||
{{ define "breadcrumbs" }} | ||
{{ .Scratch.Set "output-format" "snippet" }} | ||
{{ partial "page/breadcrumbs" . }} | ||
{{ end }} | ||
|
||
{{ define "header" }} | ||
{{ .Scratch.Set "scope" "single" }} | ||
{{ partial "page/header" . }} | ||
{{ end }} | ||
|
||
{{ define "content" }} | ||
{{ partial "article/root" . }} | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{/* a dummy template to force block overrides with no content */}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{{- $outputFormat := $.Scratch.Get "output-format" -}} | ||
<div aria-label="breadcrumb" class="breadcrumb"> | ||
<li><a href="{{.Site.BaseURL}}"{{if $outputFormat}} target="_blank" rel="noopener"{{end}}>{{ .Site.Title }}</a></li> | ||
{{- range $index, $ancestor := .Ancestors.Reverse -}} | ||
{{ if $outputFormat -}} | ||
{{ with $ancestor.OutputFormats.Get $outputFormat -}} | ||
<li><a href="{{ $ancestor.RelPermalink }}">{{ $ancestor.LinkTitle }}</a></li> | ||
{{- end }} | ||
{{- end }} | ||
{{ else }} | ||
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li> | ||
{{ end -}} | ||
<li class="active">{{ .LinkTitle }}</li> | ||
</div> |