1

The docfx documentation site shows how to customize the various .partial files used in the default template (see https://dotnet.github.io/docfx/tutorial/walkthrough/advanced_walkthrough.html).

I've followed those instructions, creating a new template folder and putting a modified styles\main.css file in it, and also took the step under the Apply the Template section where the custom template name is specified in addition to the default:

"template": [
  "default",
  "templates/<name of your your HTML template folder>"
],

However, when I build the site, the _site/styles/main.css file doesn't have my changes.

Brett Zook
  • 71
  • 6

1 Answers1

0

I'm using docfx on Windows 10, with docfx located at C:\docfx, and I exported the default template and created my custom template within that same directory.

The project I'm building is located elsewhere, at C:\source...\documentation

I'm running the docfx build after navigating to C:\source...\documentation, and I found that in order for my customized template to work, I had to include the full path to the template folders in docfx.json, as in

"template": [
  "C:/docfx/_exported_templates/default",
  "C:/docfx/templates/MyCustomTemplate"
],

UPDATE: As pointed out by @hcdocs, if the custom "templates" folder is moved into C:\source...\documentation rather than C:\docfx, there's no need to use full paths. This config worked fine after doing that:

"template": [
  "default",
  "templates/MyCustomTemplate"
],
Brett Zook
  • 71
  • 6
  • You shouldn't have to include the full path or reference the exported template. If I understand your file setup correctly, the custom `templates` directory should be in your `C:\Source...\documentation` directory, not your `C:\docfx` directory. – hcdocs Nov 15 '18 at 22:02
  • @hcdocs, you are correct. I realized after posting this that I wanted to move my custom templates folder into the C:\source...\documentation folder so it would be under source control, and doing that prevents the need to use full paths, for both the default template and my custom one. I'll be updating my answer above – Brett Zook Nov 27 '18 at 20:32