mirror of https://github.com/jpanther/congo.git
✨ Add edit links on article pages
parent
46a7031a3a
commit
d022bc8df7
|
@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Multiple colour schemes
|
- Multiple colour schemes
|
||||||
|
- Edit links on article pages
|
||||||
- Icons for Foursquare and Pinterest
|
- Icons for Foursquare and Pinterest
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<svg aria-hidden="true" focusable="false" data-prefix="far" data-icon="edit" class="svg-inline--fa fa-edit fa-w-18" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M402.3 344.9l32-32c5-5 13.7-1.5 13.7 5.7V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V112c0-26.5 21.5-48 48-48h273.5c7.1 0 10.7 8.6 5.7 13.7l-32 32c-1.5 1.5-3.5 2.3-5.7 2.3H48v352h352V350.5c0-2.1.8-4.1 2.3-5.6zm156.6-201.8L296.3 405.7l-90.4 10c-26.2 2.9-48.5-19.2-45.6-45.6l10-90.4L432.9 17.1c22.9-22.9 59.9-22.9 82.7 0l43.2 43.2c22.9 22.9 22.9 60 .1 82.8zM460.1 174L402 115.9 216.2 301.8l-7.3 65.3 65.3-7.3L460.1 174zm64.8-79.7l-43.2-43.2c-4.1-4.1-10.8-4.1-14.8 0L436 82l58.1 58.1 30.9-30.9c4-4.2 4-10.8-.1-14.9z"></path></svg>
|
After Width: | Height: | Size: 747 B |
|
@ -19,6 +19,9 @@ colorScheme = "congo"
|
||||||
showAuthor = true
|
showAuthor = true
|
||||||
showBreadcrumbs = false
|
showBreadcrumbs = false
|
||||||
showDraftLabel = true
|
showDraftLabel = true
|
||||||
|
showEdit = false
|
||||||
|
# editURL = "https://github.com/username/repo/"
|
||||||
|
editAppendPath = true
|
||||||
showHeadingAnchors = true
|
showHeadingAnchors = true
|
||||||
showPagination = true
|
showPagination = true
|
||||||
showReadingTime = true
|
showReadingTime = true
|
||||||
|
|
|
@ -39,6 +39,9 @@ relativeURLs = true
|
||||||
|
|
||||||
[params.article]
|
[params.article]
|
||||||
showBreadcrumbs = true
|
showBreadcrumbs = true
|
||||||
|
showEdit = true
|
||||||
|
editURL = "https://github.com/jpanther/congo/tree/dev/exampleSite/content/"
|
||||||
|
editAppendPath = true
|
||||||
|
|
||||||
[[menu.main]]
|
[[menu.main]]
|
||||||
name = "Docs"
|
name = "Docs"
|
||||||
|
|
|
@ -66,6 +66,9 @@ Many of the article defaults here can be overridden on a per article basis by sp
|
||||||
|`article.showAuthor`|boolean|`true`|Whether or not the author box is displayed in the article footer.|
|
|`article.showAuthor`|boolean|`true`|Whether or not the author box is displayed in the article footer.|
|
||||||
|`article.showBreadcrumbs`|boolean|`false`|Whether or not breadcrumbs are displayed in the article header.|
|
|`article.showBreadcrumbs`|boolean|`false`|Whether or not breadcrumbs are displayed in the article header.|
|
||||||
|`article.showDraftLabel`|boolean|`true`|Whether or not the draft indicator is shown next to articles when site is built with `--buildDrafts`.|
|
|`article.showDraftLabel`|boolean|`true`|Whether or not the draft indicator is shown next to articles when site is built with `--buildDrafts`.|
|
||||||
|
|`article.showEdit`|boolean|`false`|Whether or not the link to edit the article content should be displayed.|
|
||||||
|
|`article.editURL`|string|_Not set_|When `article.showEdit` is active, the URL for the edit link.|
|
||||||
|
|`article.editAppendPath`|boolean|`true`|When `article.showEdit` is active, whether or not the path to the current article should be appended to the URL set at `article.editURL`.|
|
||||||
|`article.showHeadingAnchors`|boolean|`true`|Whether or not heading anchor links are displayed alongside headings within articles.|
|
|`article.showHeadingAnchors`|boolean|`true`|Whether or not heading anchor links are displayed alongside headings within articles.|
|
||||||
|`article.showPagination`|boolean|`true`|Whether or not the next/previous article links are displayed in the article footer.|
|
|`article.showPagination`|boolean|`true`|Whether or not the next/previous article links are displayed in the article footer.|
|
||||||
|`article.showReadingTime`|boolean|`true`|Whether or not article reading times are displayed.|
|
|`article.showReadingTime`|boolean|`true`|Whether or not article reading times are displayed.|
|
||||||
|
|
|
@ -19,6 +19,9 @@ Front matter parameter default values are inherited from the theme's [base confi
|
||||||
|`externalUrl`|string|_Not set_|If this article is published on a third-party website, the URL to this article. Providing a URL will prevent a content page being generated and any references to this article will link directly to the third-party website.|
|
|`externalUrl`|string|_Not set_|If this article is published on a third-party website, the URL to this article. Providing a URL will prevent a content page being generated and any references to this article will link directly to the third-party website.|
|
||||||
|`showDate`|boolean|`article.showDate`|Whether or not article dates are displayed.|
|
|`showDate`|boolean|`article.showDate`|Whether or not article dates are displayed.|
|
||||||
|`showAuthor`|boolean|`article.showAuthor`|Whether or not the author box is displayed in the article footer.|
|
|`showAuthor`|boolean|`article.showAuthor`|Whether or not the author box is displayed in the article footer.|
|
||||||
|
|`showEdit`|boolean|`article.showEdit`|Whether or not the link to edit the article content should be displayed.|
|
||||||
|
|`editURL`|string|`article.editURL`|When `showEdit` is active, the URL for the edit link.|
|
||||||
|
|`editAppendPath`|boolean|`article.editAppendPath`|When `showEdit` is active, whether or not the path to the current article should be appended to the URL set at `editURL`.|
|
||||||
|`showHeadingAnchors`|boolean|`article.showHeadingAnchors`|Whether or not heading anchor links are displayed alongside headings within this article.|
|
|`showHeadingAnchors`|boolean|`article.showHeadingAnchors`|Whether or not heading anchor links are displayed alongside headings within this article.|
|
||||||
|`showPagination`|boolean|`article.showPagination`|Whether or not the next/previous article links are displayed in the article footer.|
|
|`showPagination`|boolean|`article.showPagination`|Whether or not the next/previous article links are displayed in the article footer.|
|
||||||
|`showReadingTime`|boolean|`article.showReadingTime`|Whether or not article reading times are displayed.|
|
|`showReadingTime`|boolean|`article.showReadingTime`|Whether or not article reading times are displayed.|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
article:
|
article:
|
||||||
anchor_label: "Anchor"
|
anchor_label: "Anchor"
|
||||||
draft: "Draft"
|
draft: "Draft"
|
||||||
|
edit_title: "Edit content"
|
||||||
reading_time:
|
reading_time:
|
||||||
one: "{{ .Count }} min"
|
one: "{{ .Count }} min"
|
||||||
other: "{{ .Count }} mins"
|
other: "{{ .Count }} mins"
|
||||||
|
|
|
@ -8,10 +8,7 @@
|
||||||
{{ .Title | emojify }}
|
{{ .Title | emojify }}
|
||||||
</h1>
|
</h1>
|
||||||
<div class="mt-8 mb-12 text-base text-neutral-400 dark:text-neutral-500">
|
<div class="mt-8 mb-12 text-base text-neutral-400 dark:text-neutral-500">
|
||||||
{{ partial "article-meta.html" . }}
|
{{ partial "article-meta.html" (dict "context" . "scope" "single") }}
|
||||||
{{ if and .Draft .Site.Params.article.showDraftLabel }}
|
|
||||||
<span class="pl-2">{{ partial "badge.html" (i18n "article.draft" | emojify) }}</span>
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<section class="prose dark:prose-light">
|
<section class="prose dark:prose-light">
|
||||||
|
@ -22,7 +19,6 @@
|
||||||
{{ partial "sharing-links.html" . }}
|
{{ partial "sharing-links.html" . }}
|
||||||
{{ partial "article-pagination.html" . }}
|
{{ partial "article-pagination.html" . }}
|
||||||
</footer>
|
</footer>
|
||||||
{{/* Comments */}}
|
|
||||||
{{ if templates.Exists "partials/comments.html" }}
|
{{ if templates.Exists "partials/comments.html" }}
|
||||||
{{ partial "comments.html" . }}
|
{{ partial "comments.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<article>
|
<article>
|
||||||
<h3 class="mt-6 text-xl font-semibold">
|
<h3 class="flex items-center mt-6 text-xl font-semibold">
|
||||||
{{ if isset .Params "externalUrl" }}
|
{{ if isset .Params "externalUrl" }}
|
||||||
<a
|
<a
|
||||||
class="hover:underline hover:underline-primary-500 hover:underline-offset-small text-neutral-800 dark:text-neutral"
|
class="hover:underline hover:underline-primary-500 hover:underline-offset-small text-neutral-800 dark:text-neutral"
|
||||||
|
@ -22,7 +22,9 @@
|
||||||
>
|
>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if and .Draft .Site.Params.article.showDraftLabel }}
|
{{ if and .Draft .Site.Params.article.showDraftLabel }}
|
||||||
|
<div class="ml-2">
|
||||||
{{ partial "badge.html" "Draft" }}
|
{{ partial "badge.html" "Draft" }}
|
||||||
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if templates.Exists "partials/extend-article-link.html" }}
|
{{ if templates.Exists "partials/extend-article-link.html" }}
|
||||||
{{ partial "extend-article-link.html" . }}
|
{{ partial "extend-article-link.html" . }}
|
||||||
|
|
|
@ -1,17 +1,39 @@
|
||||||
{{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }}
|
{{/* Determine the correct context and scope */}}
|
||||||
<time datetime="{{ .Date }}">
|
{{/* This allows for different logic depending on where the partial is called */}}
|
||||||
{{ .Date.Format .Site.Params.article.dateFormat | default "2 January 2006" }}
|
{{ $context := . }}
|
||||||
</time>
|
{{ $scope := default nil }}
|
||||||
|
|
||||||
|
{{ if (reflect.IsMap . ) }}
|
||||||
|
{{ $context = .context }}
|
||||||
|
{{ $scope = cond (not .scope) nil .scope }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if and
|
|
||||||
(.Params.showDate | default (.Site.Params.article.showDate | default true))
|
{{ with $context }}
|
||||||
(.Params.showReadingTime | default (.Site.Params.article.showReadingTime | default true))
|
{{ $meta := newScratch }}
|
||||||
(ne .ReadingTime 0)
|
|
||||||
}}
|
{{/* Gather partials for this context */}}
|
||||||
<span class="px-1 text-primary-500">·</span>
|
{{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }}
|
||||||
{{ end }}
|
{{ $meta.Add "partials" (slice (partial "meta/date.html" .)) }}
|
||||||
{{ if and (.Params.showReadingTime | default (.Site.Params.article.showReadingTime | default true)) (ne .ReadingTime 0) }}
|
{{ end }}
|
||||||
<span title="{{ i18n "article.reading_time_title" }}">
|
|
||||||
{{ i18n "article.reading_time" .ReadingTime | emojify }}
|
{{ if and (.Params.showReadingTime | default (.Site.Params.article.showReadingTime | default true)) (ne .ReadingTime 0) }}
|
||||||
</span>
|
{{ $meta.Add "partials" (slice (partial "meta/reading-time.html" .)) }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if and (eq $scope "single") (.Params.showEdit | default (.Site.Params.article.showEdit | default false)) }}
|
||||||
|
{{ $meta.Add "partials" (slice (partial "meta/edit.html" .)) }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
|
<div class="flex flex-row items-center">
|
||||||
|
{{/* Output partials */}}
|
||||||
|
{{ with ($meta.Get "partials") }}
|
||||||
|
{{ delimit . "<span class=\"px-2 text-primary-500\">·</span>" }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{/* Output draft label */}}
|
||||||
|
{{ if and (eq $scope "single") (and .Draft .Site.Params.article.showDraftLabel) }}
|
||||||
|
<span class="pl-2">{{ partial "badge.html" (i18n "article.draft" | emojify) }}</span>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -9,15 +9,12 @@
|
||||||
<span class="mr-3 article-pagination-direction">←</span>
|
<span class="mr-3 article-pagination-direction">←</span>
|
||||||
<span class="flex flex-col">
|
<span class="flex flex-col">
|
||||||
<span class="article-pagination-title">{{ .NextInSection.Title }}</span>
|
<span class="article-pagination-title">{{ .NextInSection.Title }}</span>
|
||||||
|
<span class="-mt-1 text-xs text-neutral-400 dark:text-neutral-500">
|
||||||
{{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }}
|
{{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }}
|
||||||
<time
|
{{ partial "meta/date.html" . }}
|
||||||
class="-mt-1 text-xs text-neutral-400 dark:text-neutral-500"
|
|
||||||
datetime="{{ .Date }}"
|
|
||||||
>
|
|
||||||
{{ .Date.Format .Site.Params.article.dateFormat | default "2 January 2006" }}
|
|
||||||
</time>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</span>
|
</span>
|
||||||
|
</span>
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</span>
|
</span>
|
||||||
|
@ -26,15 +23,12 @@
|
||||||
<a class="flex text-right" href="{{ .PrevInSection.Permalink }}">
|
<a class="flex text-right" href="{{ .PrevInSection.Permalink }}">
|
||||||
<span class="flex flex-col">
|
<span class="flex flex-col">
|
||||||
<span class="article-pagination-title">{{ .PrevInSection.Title }}</span>
|
<span class="article-pagination-title">{{ .PrevInSection.Title }}</span>
|
||||||
|
<span class="-mt-1 text-xs text-neutral-400 dark:text-neutral-500">
|
||||||
{{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }}
|
{{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }}
|
||||||
<time
|
{{ partial "meta/date.html" . }}
|
||||||
class="-mt-1 text-xs text-neutral-400 dark:text-neutral-500"
|
|
||||||
datetime="{{ .Date }}"
|
|
||||||
>
|
|
||||||
{{ .Date.Format .Site.Params.article.dateFormat | default "2 January 2006" }}
|
|
||||||
</time>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</span>
|
</span>
|
||||||
|
</span>
|
||||||
<span class="ml-3 article-pagination-direction">→</span>
|
<span class="ml-3 article-pagination-direction">→</span>
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<span
|
<span
|
||||||
class="ml-1 px-1 py-[1px] text-xs font-normal border rounded-md text-primary-700 dark:text-primary-400 border-primary-400 dark:border-primary-600 inline-block align-middle mb-1"
|
class="ml-1 px-1 py-[1px] text-xs font-normal border rounded-md text-primary-700 dark:text-primary-400 border-primary-400 dark:border-primary-600 flex"
|
||||||
>
|
>
|
||||||
{{ . }}
|
{{ . }}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<time datetime="{{ .Date }}">
|
||||||
|
{{- .Date.Format .Site.Params.article.dateFormat | default "2 January 2006" -}}
|
||||||
|
</time>
|
||||||
|
{{- /* Trim EOF */ -}}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{{ $url := .Params.editURL | default (.Site.Params.article.editURL | default "#") }}
|
||||||
|
{{ $slash := "" }}
|
||||||
|
{{ if .Params.editAppendPath | default ( .Site.Params.article.editAppendPath | default false ) }}
|
||||||
|
{{ if ne (substr $url -1 1) "/" }}
|
||||||
|
{{ $slash = "/" }}
|
||||||
|
{{ end }}
|
||||||
|
{{ $url = printf "%s%s%s" $url $slash (path.Join .File.Path) }}
|
||||||
|
{{ end }}
|
||||||
|
<span class="mb-[2px]">
|
||||||
|
<a
|
||||||
|
href="{{ $url }}"
|
||||||
|
class="text-lg hover:text-primary-500"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
target="_blank"
|
||||||
|
title="{{ i18n "article.edit_title" }}"
|
||||||
|
>{{ partial "icon.html" "edit" }}</a
|
||||||
|
>
|
||||||
|
</span>
|
||||||
|
{{- /* Trim EOF */ -}}
|
|
@ -0,0 +1,4 @@
|
||||||
|
<span title="{{ i18n "article.reading_time_title" }}">
|
||||||
|
{{- i18n "article.reading_time" .ReadingTime | emojify -}}
|
||||||
|
</span>
|
||||||
|
{{- /* Trim EOF */ -}}
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue