File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6868 shell : pwsh
6969 run : .\docfx\docfx.exe docfx.json
7070
71+ - name : Inject canonical link into every index.html
72+ shell : pwsh
73+ run : |
74+ $Origin = 'https://docs.richardson.dev'
75+ $SiteRoot = Resolve-Path _site
76+ Get-ChildItem $SiteRoot -Recurse -Filter index.html | ForEach-Object {
77+ $rel = ($_.FullName.Substring($SiteRoot.Path.Length) -replace '\\','/')
78+ $canon = $Origin + ($rel -replace 'index\.html$','')
79+ (Get-Content $_.FullName -Raw) -replace '</head>', (
80+ "<link rel=`"canonical`" href=`"$canon`" />`n</head>"
81+ ) | Set-Content $_.FullName
82+ }
83+
84+ - name : Install html-minifier-terser
85+ run : npm install -g html-minifier-terser
86+
87+ - name : Minify HTML output
88+ shell : pwsh
89+ run : |
90+ html-minifier-terser `
91+ --input-dir _site `
92+ --output-dir _site `
93+ --file-ext html `
94+ --collapse-whitespace `
95+ --remove-comments `
96+ --remove-optional-tags `
97+ --minify-css true `
98+ --minify-js true
99+
71100 - name : Upload artifact
72101 uses : actions/upload-artifact@v4
73102 with :
You can’t perform that action at this time.
0 commit comments