Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/fifty-hornets-follow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"apostrophe": minor
---

- Removed duplicate <meta charset> tag from `outerLayoutBase.html`
- Standardized charset to utf-8 (removed legacy configuration option)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

because the spec literally says there's only one allowable value, yeah

- Altered unused/legacy i18n template helper to return `utf-8` (BC)
9 changes: 1 addition & 8 deletions packages/apostrophe/modules/@apostrophecms/i18n/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
// in the same language as the website content.
// Example: `defaultAdminLocale: 'fr'`.
//
// ### `encoding`
//
// Defaults to `'utf-8'`. You almost certainly do not want to change this.
//
// ### `slugDirection`
//
// Controls the default `direction` value of slug schema. Can be `ltr`, `rtl` or
Expand Down Expand Up @@ -81,8 +77,6 @@ module.exports = {
},
// If true, slugifying will strip accents from Latin characters
stripUrlAccents: false,
// You almost certainly do not want to change this
encoding: 'utf-8',
slugDirection: 'ltr'
},
async init(self) {
Expand Down Expand Up @@ -166,7 +160,6 @@ module.exports = {
await self.i18next.init(i18nextOptions);
self.addInitialResources();
self.enableBrowserData();
self.encoding = self.options.encoding;
},
handlers(self) {
return {
Expand Down Expand Up @@ -1369,7 +1362,7 @@ module.exports = {
helpers(self) {
return {
encoding() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

needs to stick around for bc and return utf-8

return self.encoding;
return 'utf-8';
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html lang="{% block locale %}{{ data.locale }}{% endblock %}" dir="{% block direction %}{{ data.i18n.direction or 'ltr' }}{% endblock %}" {% block extraHtml %}{% endblock %}>
<head>
{% block encoding %}
{# Per spec (https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/meta#charset) the only allowed value for this attribute is `utf-8` and this meta element must be in the first 1kb of the document #}
<meta charset="utf-8">
{% endblock %}
{% block startHead %}
Expand All @@ -15,7 +16,6 @@

{% block standardHead %}
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="{{ apos.i18n.encoding() }}">
{% endblock %}
{% component '@apostrophecms/template:inject' with { where: 'head', end: 'append', when: 'hmr' } %}
{% component '@apostrophecms/template:inject' with { where: 'head', end: 'append' } %}
Expand Down
Loading