From ee181818c030315a69eff69faf79a7f2ba09b59f Mon Sep 17 00:00:00 2001 From: Nicolas Paul Date: Tue, 2 May 2023 22:30:41 +0200 Subject: Make slug have the file extension --- crocc.go | 3 ++- doc/src/.crocc.html | 21 +++++++++++---------- sitemap.go | 5 +++++ 3 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 sitemap.go diff --git a/crocc.go b/crocc.go index e88ab33..d274992 100644 --- a/crocc.go +++ b/crocc.go @@ -21,6 +21,7 @@ var ( url = flag.String("url", "http://localhost", "site URL") generateHidden = flag.Bool("hidden", false, "generate hidden pages") printVersion = flag.Bool("version", false, "print version and exit") + sitemap = flag.Bool("sitemap", false, "generate sitemap (will overwrite existing sitemap.xml)") ) const usage string = `crocc is a simple Markdown-based static site generator. @@ -136,7 +137,7 @@ func Crocc(path string, d os.DirEntry, e error) error { // If the file is a Markdown file, transform it into HTML o = strings.TrimSuffix(o, filepath.Ext(o)) + ".html" - s := strings.TrimSuffix(strings.TrimPrefix(o, *out), ".html") + s := strings.TrimPrefix(o, *out) if err := TransformMarkdownFile(path, o, s); err != nil { return err } diff --git a/doc/src/.crocc.html b/doc/src/.crocc.html index 490ac42..cd9da25 100644 --- a/doc/src/.crocc.html +++ b/doc/src/.crocc.html @@ -6,8 +6,7 @@ --> - - + {{ .Title }} @@ -17,7 +16,8 @@ - + + @@ -25,23 +25,24 @@ - + - - - - - + + + + +
diff --git a/sitemap.go b/sitemap.go new file mode 100644 index 0000000..732dfd5 --- /dev/null +++ b/sitemap.go @@ -0,0 +1,5 @@ +// Copyright (c) 2023 Nicolas Paul All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main -- cgit v1.2.3