diff --git a/exampleSite/hugo.yaml b/exampleSite/hugo.yaml index 41a4565..7c15f91 100644 --- a/exampleSite/hugo.yaml +++ b/exampleSite/hugo.yaml @@ -15,6 +15,12 @@ taxonomies: markup: # this just keeps the bobatheme markup styling _merge: deep +outputs: + _merge: deep + +outputFormats: + _merge: deep + params: author: name: bbaovanc diff --git a/hugo.yaml b/hugo.yaml index f24c261..9fe82d2 100644 --- a/hugo.yaml +++ b/hugo.yaml @@ -12,6 +12,15 @@ taxonomies: author: authors series: series +outputs: + page: + - html + - markdown + +outputFormats: + markdown: + ugly: true + privacy: googleAnalytics: disable: true diff --git a/i18n/en.yaml b/i18n/en.yaml index b6dff1d..41890c4 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -30,6 +30,9 @@ readingtime: edit_history: other: "Edit history" +view_markdown: + other: "View raw" + # Post count no_posts: @@ -67,6 +70,9 @@ aria_rss_link: aria_post_meta_edit_history: other: "link to page edit history" +aria_post_meta_view_markdown: + other: "link to view raw markdown code of page" + aria_post_meta_categories: other: "categories" diff --git a/layouts/_default/single.markdown.md b/layouts/_default/single.markdown.md new file mode 100644 index 0000000..d8f8dd7 --- /dev/null +++ b/layouts/_default/single.markdown.md @@ -0,0 +1,9 @@ +{{ with .File -}} + {{ with (.Path | readFile) -}} + {{ . -}} + {{ else -}} + {{ errorf "file not found: %s" .Path -}} + {{ end -}} +{{ else -}} + {{ errorf "no file available for markdown template?" -}} +{{ end -}} diff --git a/layouts/partials/page-metadata/item/viewraw.html b/layouts/partials/page-metadata/item/viewraw.html new file mode 100644 index 0000000..4484e05 --- /dev/null +++ b/layouts/partials/page-metadata/item/viewraw.html @@ -0,0 +1,8 @@ +{{ with .OutputFormats.Get "markdown" }} + + {{ partial "icon.html" "code" }} + + {{- i18n "view_markdown" -}} + + +{{ end }} diff --git a/layouts/partials/page-metadata/post-full.html b/layouts/partials/page-metadata/post-full.html index 93225bb..bd13f4d 100644 --- a/layouts/partials/page-metadata/post-full.html +++ b/layouts/partials/page-metadata/post-full.html @@ -20,7 +20,10 @@ {{ partial "page-metadata/item/authors.html" . }} {{ partial "page-metadata/item/readingtime.html" . }} {{ partial "page-metadata/item/edithistory.html" . }} + {{ partial "page-metadata/item/viewraw.html" . }} + {{ partial "page-metadata/item/categories.html" . }} + {{ partial "page-metadata/item/tags.html" . }} {{ end }}