Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the footer in DocFX?

Tags:

docfx

Just hope to change the footer copyright info, generated by DocFX.

footer

Here is what I have done:

  1. Export template:

Run docfx template export default, get a folder _exported_templates\default

  1. Change the footer partials:

The files I have changed are .\partials_footer.liquid and .\partials\footer.tmpl.partial

  1. Use the updated template:

Run docfx -t _exported_templates\default.

  1. Serve the site again

Run docfx docfx.json --serve.

But the update is not shown when I refresh the documentation page. Is there anything else I have missed?

like image 372
Blaise Avatar asked Jul 07 '17 18:07

Blaise


2 Answers

Try merge step 3, 4 into: docfx -t _exported_templates\default --serve.

Explanation: If you open the build output in _site after step 3, you should find the footer is actually updated. In step 4, DocFX builds the site again before serving, so finally you find the original footer because this build doesn't use your customized template.

Another quick solution is to add _appFooter to global metadata in docfx.json like:

"globalMetadata": {
  "_appFooter": "<span>Customized Footer</span>"
},

Full reserved metadata list can be found here: http://dotnet.github.io/docfx/tutorial/docfx.exe_user_manual.html#322-reserved-metadata

like image 133
Yuby Avatar answered Oct 25 '22 02:10

Yuby


The easiest way to do this is to change the model directly. In your template, create a file called conceptual.extension.js and use the following code:

exports.postTransform = function (model) {
    model._appFooter = "<span>Copyright © 2015-2017 MY COPYRIGHT<br>Generated by <strong>DocFX</strong></span>";
    return model;
}
like image 34
RoelF Avatar answered Oct 25 '22 00:10

RoelF