Skip to content

Commit a6661a6

Browse files
Merge pull request #2 from danielmccluskey/main
Added relative link to edit the markdown files.
2 parents ce3a4d6 + 86032d9 commit a6661a6

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

src/Downpatch.Web/Components/Pages/Guide.razor

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ else
9696
</div>
9797

9898
<footer class="docs-footer">
99-
<p class="muted">Found an issue? Edit the markdown and submit a PR.</p>
99+
<p class="muted">
100+
Found an issue?
101+
<a href="@GetEditUrl(Slug)" target="_blank" rel="noopener">Edit the markdown</a> and submit a PR.
102+
</p>
100103
</footer>
101104
</main>
102105

@@ -291,4 +294,16 @@ else
291294

292295
return new string(buf[..w]);
293296
}
297+
298+
private static string GetEditUrl(string? slug)
299+
{
300+
// Default to guide/index.md if no slug
301+
var baseUrl = "https://github.com/downpatch/content/blob/main/guide";
302+
if (string.IsNullOrWhiteSpace(slug))
303+
return $"{baseUrl}/index.md";
304+
305+
// Sanitize and build path
306+
var path = slug.Trim('/').Replace('\\', '/');
307+
return $"{baseUrl}/{path}.md";
308+
}
294309
}

0 commit comments

Comments
 (0)