Skip to content

Fix doc links (#884) - #886

Merged
Romfos merged 3 commits into
nsubstitute:mainfrom
dtchepak:fix-docs
Jul 13, 2025
Merged

Romfos merged 3 commits into
nsubstitute:mainfrom
dtchepak:fix-docs

Conversation

@dtchepak

@dtchepak dtchepak commented Jun 9, 2025

Copy link
Copy Markdown
Member
  • move /docs to /help
  • remove dates from doc names
  • move docs to sub-directories and rename to index.md so we get nice urls (e.g. help/example rather than help/example.html.
  • use wget --spider to detect and fix broken links.
  • fix search rendering. Note: dark mode does not play nicely with the GCSE input box1
  • rearrange home page to put install links at the top

@Romfos

Romfos commented Jun 13, 2025 •

Copy link
Copy Markdown
Contributor

I propose to don't do subdirectories
URLs without *.html works automatically. example: https://nsubstitute.github.io/docs/2010-02-10-replacing-return-values
Looks like this is local debug server bug
Make sense just remove dates because solution with index.html looks strange

@dtchepak WDYT?

@304NotModified
304NotModified removed their request for review June 16, 2025 20:38
Comment thread docs/help/toc.yml Resolved
@dtchepak

Copy link
Copy Markdown
Member Author

I propose to don't do subdirectories URLs without *.html works automatically. example: https://nsubstitute.github.io/docs/2010-02-10-replacing-return-values Looks like this is local debug server bug Make sense just remove dates because solution with index.html looks strange

@dtchepak WDYT?

I'm not sure about this. 🤔 It is relying on github pages specific implementation right? I kind of like being able to do python3 -m http.server 8080 -d _site and have it be representative of what the real site will look like. If you feel strongly about it though i'm happy to update this PR as suggested 👍

dtchepak added 2 commits June 22, 2025 13:31
- move `/docs` to `/help`
- remove dates from doc names
- move docs to sub-directories and rename to index.md so we get nice
  urls (e.g. `help/example` rather than `help/example.html`.
- use `wget --spider` to detect and fix broken links.
- fix search rendering. Note: dark mode does not play nicely with the
  GCSE input box[1]

[1]: https://support.google.com/programmable-search/
- include all doc *.md files in tests
- name doc tests using directory name if file name is
  `index.*`.
{
return $"Tests_{Path.GetFileNameWithoutExtension(markdownFile.Path).Replace("-", "_")}";
var file = Path.GetFileNameWithoutExtension(markdownFile.Path);
var pathSegments = markdownFile.Path.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);

@Romfos Romfos Jun 22, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can avoid manually working with paths

var fileName = Path.GetFileNameWithoutExtension(markdownFile.Path);
var directoryName = new FileInfo(markdownFile.Path).Directory.Name;
var nameToUse = string.Equals(fileName, "index", StringComparison.InvariantCultureIgnoreCase) ? directoryName  : fileName;
return $"Tests_{nameToUse.Replace("-", "_")}";

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied suggestion 👍

@Romfos

Romfos commented Jun 22, 2025

Copy link
Copy Markdown
Contributor

I propose to don't do subdirectories URLs without *.html works automatically. example: https://nsubstitute.github.io/docs/2010-02-10-replacing-return-values Looks like this is local debug server bug Make sense just remove dates because solution with index.html looks strange
@dtchepak WDYT?

I'm not sure about this. 🤔 It is relying on github pages specific implementation right? I kind of like being able to do python3 -m http.server 8080 -d _site and have it be representative of what the real site will look like. If you feel strongly about it though i'm happy to update this PR as suggested 👍

If we need support other platforms then github pages - maybe this is fine

@Romfos Romfos mentioned this pull request Jun 27, 2025
22 of 26 tasks
@Romfos
Romfos requested a review from Copilot June 27, 2025 16:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes and improves documentation links by moving content from the /docs to the /help directory, updating URL patterns, and adjusting tests accordingly.

  • Update csproj file to recursively include markdown files from the new docs structure.
  • Refactor test file name generation to accommodate renamed and reorganized documentation files.
  • Update table of contents and link references to point to the new /help location and remove outdated docs.

Reviewed Changes

Copilot reviewed 10 out of 34 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/NSubstitute.Documentation.Tests/NSubstitute.Documentation.Tests.csproj Updated wildcard inclusion for markdown files in the new structure
tests/NSubstitute.Documentation.Tests.Generator/DocumentationTestsGenerator.cs Modified test class name generation to consider folder names
docs/toc.yml Updated links from docs/ to help/
docs/index.md Added download sidebar and restructured the documentation home page
docs/help/toc.yml New table of contents for the help directory
docs/help/search/index.md New search page with Google CSE integration
docs/help/creating-a-substitute/index.md Updated link for "How NSubstitute works" for correct trailing slash
docs/help.md Updated links from /docs/ to /help/
docs/docs/toc.yml Removed outdated table of contents for legacy docs
docs/docs/2019-01-01-search.md Deleted outdated search page

@304NotModified

Copy link
Copy Markdown
Contributor

@Romfos could you merge this pr? Would be great to see the links working again.

@Romfos

Romfos commented Jul 6, 2025

Copy link
Copy Markdown
Contributor

@304NotModified I don't have merge permission. We need wait @dtchepak for feedback

@304NotModified

Copy link
Copy Markdown
Contributor

Unfortunately I also don't have merge permission

@dtchepak

Copy link
Copy Markdown
Member Author

@304NotModified I don't have merge permission. We need wait @dtchepak for feedback

I think I've fixed this now @304NotModified and @Romfos 🤞
Let me know if you still do not have permission.

@Romfos

Romfos commented Jul 13, 2025

Copy link
Copy Markdown
Contributor

@dtchepak yes, I have it. Please deploy new version after fix

@Romfos
Romfos merged commit 314fe3c into nsubstitute:main Jul 13, 2025
@dtchepak
dtchepak deleted the fix-docs branch July 13, 2025 10:55
@dtchepak

Copy link
Copy Markdown
Member Author

Deployed ✔️

This was referenced Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants