Skip to content

Commit

Permalink
chore!: drop _docfxVersion in generated HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeih committed Dec 19, 2022
1 parent 5abecf8 commit 30e2885
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 27 deletions.
23 changes: 11 additions & 12 deletions src/docfx.website.themes/default/partials/_head.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,35 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
{%- if title and _appTitle -%}
<title>{{title}} | {{appTitle}}</title>
<meta name="title" content="{{title}} | {{appTitle}}">
<title>{{ title }} | {{ appTitle }}</title>
<meta name="title" content="{{title}} | {{appTitle}}">
{%- else -%}
{%- if title or _appTitle -%}
<title>{{title}}{{appTitle}}</title>
<meta name="title" content="{{title}}{{appTitle}}">
<title>{{ title }}{{ appTitle }}</title>
<meta name="title" content="{{title}}{{appTitle}}">
{%- endif -%}
{%- endif -%}
<meta name="viewport" content="width=device-width">
<meta name="generator" content="docfx {{_docfxVersion}}">
{%- if _description -%}
<meta name="description" content="{{_description}}">
<meta name="description" content="{{_description}}">
{%- endif -%}
{%- if _appFaviconPath -%}
<link rel="shortcut icon" href="{{_rel}}{{_appFaviconPath}}">
<link rel="shortcut icon" href="{{_rel}}{{_appFaviconPath}}">
{%- else -%}
<link rel="shortcut icon" href="{{_rel}}favicon.ico">
<link rel="shortcut icon" href="{{_rel}}favicon.ico">
{%- endif -%}
<link rel="stylesheet" href="{{_rel}}styles/docfx.vendor.css">
<link rel="stylesheet" href="{{_rel}}styles/docfx.css">
<link rel="stylesheet" href="{{_rel}}styles/main.css">
<meta property="docfx:navrel" content="{{_navRel}}">
<meta property="docfx:tocrel" content="{{_tocRel}}">
{%- if _noindex -%}
<meta name="searchOption" content="noindex">
<meta name="searchOption" content="noindex">
{%- endif -%}
{%- if _enableSearch -%}
<meta property="docfx:rel" content="{{_rel}}">
<meta property="docfx:rel" content="{{_rel}}">
{%- endif -%}
{%- if _enableNewTab -%}
<meta property="docfx:newtab" content="true">
<meta property="docfx:newtab" content="true">
{%- endif -%}
</head>
</head>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<title>{{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}}</title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="{{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}}">
<meta name="generator" content="docfx {{_docfxVersion}}">
{{#_description}}<meta name="description" content="{{_description}}">{{/_description}}
<link rel="shortcut icon" href="{{_rel}}{{{_appFaviconPath}}}{{^_appFaviconPath}}favicon.ico{{/_appFaviconPath}}">
<link rel="stylesheet" href="{{_rel}}styles/docfx.vendor.css">
Expand Down
14 changes: 0 additions & 14 deletions src/docfx/SubCommands/BuildCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ namespace Microsoft.DocAsCode.SubCommands

internal sealed class BuildCommand : ISubCommand
{
private readonly string _version;

private readonly TemplateManager _templateManager;

public string Name { get; } = nameof(BuildCommand);
Expand All @@ -33,7 +31,6 @@ public BuildCommand(BuildJsonConfig config)
Config = config;

var assembly = typeof(Program).Assembly;
_version = EnvironmentContext.Version;

SetDefaultConfigValue(Config);

Expand Down Expand Up @@ -75,17 +72,6 @@ private void SetDefaultConfigValue(BuildJsonConfig config)
{
Config.Templates = new ListWithStringFallback { DocAsCode.Constants.DefaultTemplateName };
}
if (config.GlobalMetadata == null)
{
config.GlobalMetadata = new Dictionary<string, object>
{
["_docfxVersion"] = _version
};
}
else if (!config.GlobalMetadata.ContainsKey("_docfxVersion"))
{
config.GlobalMetadata["_docfxVersion"] = _version;
}
}

/// <summary>
Expand Down

3 comments on commit 30e2885

@KalleOlaviNiemitalo
Copy link

Choose a reason for hiding this comment

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

I noticed this change when I was comparing the output of DocFX v2.58.5 vs. v2.60.0-preview.2 to validate the upgrade.
Was this needed because of the new extensibility model, in which the assembly version of Microsoft.DocAsCode.Plugins might no longer match the version of the tool being used?

@yufeih
Copy link
Contributor Author

@yufeih yufeih commented on 30e2885 Jan 6, 2023

Choose a reason for hiding this comment

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

I noticed this change when I was comparing the output of DocFX v2.58.5 vs. v2.60.0-preview.2 to validate the upgrade. Was this needed because of the new extensibility model, in which the assembly version of Microsoft.DocAsCode.Plugins might no longer match the version of the tool being used?

This is mainly to produce deterministic/stable output, so output stays the same regardless of docfx changes. #1251
Do you need this info for troubleshooting purposes? Maybe I could stamp the output manifest file instead of stamping every HTML file.

@KalleOlaviNiemitalo
Copy link

Choose a reason for hiding this comment

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

No I don’t need it for troubleshooting, was just curious about the motivation.

#1251 mentions “committing docs generated with a new version of DocFx” and we don’t commit them at all.

Please sign in to comment.