mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-14 01:32:11 +00:00
Use XML declaration on XHTML, other XHTML tweaks
- Remove XHTML content-type meta header from HTML documents, reverting back to the meta charset - Give XHTML documents their own XHTML declaration - Remove now-redundant meta charset from XHTML - Since XHTML and HTML documents differ now, compress after running xhtmlize and make xhtmlize only act on uncompressed files. - Validate XHTML using vnu
This commit is contained in:
parent
c936ca1902
commit
b4850ed89a
4 changed files with 9 additions and 16 deletions
4
Makefile
4
Makefile
|
@ -104,8 +104,8 @@ deploy: deploy-html deploy-gemini
|
||||||
.prepare-deploy:
|
.prepare-deploy:
|
||||||
@$(MAKE) clean
|
@$(MAKE) clean
|
||||||
@$(MAKE) hugo
|
@$(MAKE) hugo
|
||||||
@$(MAKE) compress
|
|
||||||
@$(MAKE) xhtmlize
|
@$(MAKE) xhtmlize
|
||||||
|
@$(MAKE) compress
|
||||||
|
|
||||||
# deploy steps need to happen one at a time
|
# deploy steps need to happen one at a time
|
||||||
.PHONY: deploy-prod
|
.PHONY: deploy-prod
|
||||||
|
@ -127,8 +127,8 @@ deploy-staging:
|
||||||
.lint-and-prepare-deploy:
|
.lint-and-prepare-deploy:
|
||||||
@$(MAKE) clean
|
@$(MAKE) clean
|
||||||
@$(MAKE) hugo
|
@$(MAKE) hugo
|
||||||
@$(MAKE) lint-local compress
|
|
||||||
@$(MAKE) xhtmlize
|
@$(MAKE) xhtmlize
|
||||||
|
@$(MAKE) lint-local compress
|
||||||
|
|
||||||
.PHONY: lint-and-deploy-staging
|
.PHONY: lint-and-deploy-staging
|
||||||
lint-and-deploy-staging:
|
lint-and-deploy-staging:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
|
<meta charset="UTF-8" />
|
||||||
{{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }}
|
{{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }}
|
||||||
<meta name="disabled-adaptations" content="watch" /><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
<meta name="disabled-adaptations" content="watch" /><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||||
{{ if or (eq site.BaseURL site.Params.CanonicalBaseURL) (in site.BaseURL "wgq3bd2kqoybhstp77i3wrzbfnsyd27wt34psaja4grqiezqircorkyd.onion") -}}
|
{{ if or (eq site.BaseURL site.Params.CanonicalBaseURL) (in site.BaseURL "wgq3bd2kqoybhstp77i3wrzbfnsyd27wt34psaja4grqiezqircorkyd.onion") -}}
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
<link href="{{ .Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}" rel="canonical" />
|
<link href="{{ .Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}" rel="canonical" />
|
||||||
<link href="{{ .Site.Params.WebmentionEndpoint }}" rel="webmention" />
|
<link href="{{ .Site.Params.WebmentionEndpoint }}" rel="webmention" />
|
||||||
{{ $webmanifest := resources.Get "/manifest.webmanifest" | resources.ExecuteAsTemplate "manifest.webmanifest" . | resources.Minify | resources.Fingerprint "md5" -}}
|
{{ $webmanifest := resources.Get "/manifest.webmanifest" | resources.ExecuteAsTemplate "manifest.webmanifest" . | resources.Minify | resources.Fingerprint "md5" -}}
|
||||||
{{- printf `<link href="%s" rel="manifest" />` $webmanifest.RelPermalink | safeHTML }}
|
{{- printf `<link href="%s" rel="manifest" />` $webmanifest.RelPermalink | safeHTML -}}
|
||||||
<!--Feeds for both notes and posts; posts come first unless we're in the notes section.-->
|
<!--Feeds for both notes and posts; posts come first unless we're in the notes section.-->
|
||||||
{{- $isNotes := false -}}
|
{{- $isNotes := false -}}
|
||||||
{{- if or (eq .Section "notes") (eq .Title "Notes") -}}
|
{{- if or (eq .Section "notes") (eq .Title "Notes") -}}
|
||||||
|
|
|
@ -11,14 +11,8 @@
|
||||||
or
|
or
|
||||||
( # See https://github.com/validator/validator/issues/1166
|
( # See https://github.com/validator/validator/issues/1166
|
||||||
.message == "Attribute “media” not allowed on element “meta” at this point."
|
.message == "Attribute “media” not allowed on element “meta” at this point."
|
||||||
and .firstColumn == 1
|
|
||||||
and (.extract | test(" name=\"theme-color\""))
|
and (.extract | test(" name=\"theme-color\""))
|
||||||
)
|
)
|
||||||
or
|
|
||||||
( # XHTML5 gang
|
|
||||||
.message == "Bad value “application/xhtml+xml; charset=utf-8” for attribute “content” on element “meta”: The legacy encoding declaration did not start with “text/html;”."
|
|
||||||
and .firstColumn == 1
|
|
||||||
)
|
|
||||||
) | not
|
) | not
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# takes an arg for the output dir.
|
# takes an arg for the output dir.
|
||||||
# copies every .html file to an equivalent .xhtml file.
|
# copies every .html file to an equivalent .xhtml file, but replaces
|
||||||
# does the same for compressed html files.
|
# the meta charset with an XML declaration for compatibility with some
|
||||||
|
# XML tooling.
|
||||||
# this means that every index.html file has an equivalent index.xhtml file.
|
# this means that every index.html file has an equivalent index.xhtml file.
|
||||||
# content negotiation allows an agent to pick html or xhtml.
|
# content negotiation allows an agent to pick html or xhtml.
|
||||||
|
|
||||||
# too lazy to DRY this shit
|
find "$1" -type f -name '*.html' \
|
||||||
find "$1" -type f -name '*.html' -exec sh -c 'cp "$0" "${0%*.html}.xhtml"' {} \;
|
-exec sh -c 'echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | cat - "$0" | grep -Fv "<meta charset=\"UTF-8\" />" >"${0%*.html}.xhtml"' {} \;
|
||||||
find "$1" -type f -name '*.html.gz' -exec sh -c 'cp "$0" "${0%*.html.gz}.xhtml.gz"' {} \;
|
|
||||||
find "$1" -type f -name '*.html.br' -exec sh -c 'cp "$0" "${0%*.html.br}.xhtml.br"' {} \;
|
|
||||||
# done
|
# done
|
||||||
|
|
Loading…
Reference in a new issue