Custom template not applied when specified in docfx.json
See original GitHub issueCustom template not applied when specified in docfx.json
Applying a custom template works when used a parameter from command line, but does not work when specified in docfx.json configuration file.
Functional impact
In automatic build have to specify command line parameters instead of using the configuration file
Minimal repro steps
See attached docfx project, we try to add the Application Insights JavaScript snipped to the head of the html.
OK
docfx -t default,templates\mytemplate
NOK
docfx docfx-custom-template.json
Expected result
The JavaScript snippet from templates\mytemplate\partials\head.tmpl.partial to be included in the html
Actual result
Custom template is not applied when setting the template in the docfx configuration file
Further technical details
the custom template is specified in the docfx-custom-template.json as follow, see attached docfx project:
"build": {
"template": [
"default",
"templates/mytemplate"
],
"content": [
{
"files": [
"api/**.yml",
"api/index.md",
"api-vb/**.yml"
]
},
...
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Why aren't my customized template files being applied by ...
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 ......
Read more >How-to: Create A Custom Template | docfx
In the documentation project, run docfx build docfx.json -t c:/docfx_howto/simple_template --serve . The -t command option specifies the template name(s) used ...
Read more >Config Reference | docfx
The docfx.json file indicates that the directory is the root of a docfx project. ... If set to true, the template will not...
Read more >Introduction to the DocFX Template System
The DocFX template system provides a flexible way of defining and using templates to control how the final output files are rendered. These...
Read more >Template | docfx
Name Type Description
_appTitle string A string append to every page title.
_appName string The name of the site displayed after logo.
_appFooter string The footer...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
One thing that the documentation doesn’t make clear is that the templates directory goes off the root of the project, rather than the DocFX application root directory.
I noticed that in your docfx-custom-template.json it defined two
template
section, one as the first property forbuild
section, one as the last property forbuild
section. Remove one and have a retry.