diff --git a/source/BuildOptions.cs b/source/BuildOptions.cs
index 4a7ec02410631dd9e04e13348756b884acf7a906..fc272146c7a6c445fc7de657df22e4ed66fbdec7 100644
--- a/source/BuildOptions.cs
+++ b/source/BuildOptions.cs
@@ -9,7 +9,7 @@ public class BuildOptions : IGenerateOptions
public string Source { get; set; } = ".";
///
- public string Output { get; set; } = "./public";
+ public string? Output { get; init; }
///
public bool Future { get; set; }
diff --git a/source/IGenerateOptions.cs b/source/IGenerateOptions.cs
index 152f9204bc55d7300e20005b7f11aed919d275b2..585b7491a86aa6e47879a65a21ff866a21edcb7a 100644
--- a/source/IGenerateOptions.cs
+++ b/source/IGenerateOptions.cs
@@ -8,15 +8,15 @@ public interface IGenerateOptions
///
/// The path of the source files.
///
- string Source { get; set; }
+ string Source { get; }
///
/// The path of the output files.
///
- public string Output { get; set; }
+ public string? Output { get; }
///
/// Consider
///
- bool Future { get; set; }
+ bool Future { get; }
}
\ No newline at end of file
diff --git a/source/Models/Frontmatter.cs b/source/Models/Frontmatter.cs
index 4de58bb2a7654e2e62603a0ce8e21a17151ab974..621f4c2a80e91a7dc1695a6029fb58535fe2c8c6 100644
--- a/source/Models/Frontmatter.cs
+++ b/source/Models/Frontmatter.cs
@@ -314,8 +314,15 @@ public class Frontmatter : IBaseContent, IParams
var permaLink = string.Empty;
URLforce ??= URL
- ?? (isIndex ? "{{ page.SourcePathDirectory }}" : "{{ page.SourcePathDirectory }}/{{ page.Title }}");
-
+ ?? (isIndex
+ ? "{{ page.SourcePathDirectory }}"
+ : @"{{ page.SourcePathDirectory }}/{%- liquid
+if page.Title != ''
+echo page.Title
+else
+echo page.SourceFileNameWithoutExtension
+endif
+-%}");
try
{
diff --git a/source/Program.cs b/source/Program.cs
index 055f529a8dbcd0792117090a02bd02fddfbb5543..87a217aaea2205cfc0eb732a70d1af1034875cc6 100644
--- a/source/Program.cs
+++ b/source/Program.cs
@@ -1,4 +1,5 @@
using System.CommandLine;
+using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using Serilog;
@@ -50,11 +51,11 @@ public class Program
// Shared options between the commands
var sourceOption = new Option(new[] { "--source", "-s" }, () => ".", "Source directory path");
- var futureOption = new Option(new[] { "--future", "-f" }, () => false, "Include content with dates in the future");
- var verboseOption = new Option(new[] { "--verbose", "-v" }, () => false, "Verbose output");
+ var futureOption = new Option(new[] { "--future", "-f" }, "Include content with dates in the future");
+ var verboseOption = new Option(new[] { "--verbose", "-v" }, "Verbose output");
// BuildCommand setup
- var buildOutputOption = new Option(new[] { "--output", "-o" }, () => "./public", "Output directory path");
+ var buildOutputOption = new Option(new[] { "--output", "-o" }, "Output directory path");
Command buildCommandHandler = new("build", "Builds the site")
{
@@ -68,7 +69,7 @@ public class Program
BuildOptions buildOptions = new()
{
Source = source,
- Output = output,
+ Output = string.IsNullOrEmpty(output) ? Path.Combine(source, "public") : output,
Future = future
};
logger = new LoggerConfiguration()
diff --git a/source/ServeOptions.cs b/source/ServeOptions.cs
index fe9d50de7387be755d8abe67dd5f948462a73f1c..86169f77a999664e1aec92d1ede1b6bc9e4cfdda 100644
--- a/source/ServeOptions.cs
+++ b/source/ServeOptions.cs
@@ -9,7 +9,7 @@ public class ServeOptions : IGenerateOptions
public string Source { get; set; } = ".";
///
- public string Output { get; set; } = "./public";
+ public string? Output { get; set; }
///
public bool Future { get; set; }