question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom template not applied when specified in docfx.json

See original GitHub issue

Custom 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.

DocFx.zip

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:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
txwizardcommented, Sep 13, 2018

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.

1reaction
vicancycommented, Jul 3, 2017

I noticed that in your docfx-custom-template.json it defined two template section, one as the first property for build section, one as the last property for build section. Remove one and have a retry. image

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found