Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Handle optional language tag in header #497

Merged
merged 1 commit into from
Nov 4, 2024
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
8 changes: 7 additions & 1 deletion _includes/2020/templates/Head.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ static function render($fields = []) {
$fields->js = [];
}
?><!DOCTYPE html>
<html lang="<?= $fields->language ?>">
<?php
if (!empty($fields->language)) {
echo "<html lang='$fields->language'>";
} else {
echo "<html>";
}
?>
<head>
<meta charset="utf-8">
<?php
Expand Down
4 changes: 4 additions & 0 deletions _includes/includes/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ function head($args=[]){
if(isset($args['description'])) {
$description = $args['description'];
}
if(isset($args['language'])) {
$language = $args['language'];
}
if(isset($args['css'])){
$css = array();
foreach($args['css'] as $cssFile){
Expand Down Expand Up @@ -85,6 +88,7 @@ function head($args=[]){
if(isset($title)) $head['title'] = $title;
if(isset($description)) $head['description'] = $description;
if(isset($favicon)) $head['favicon'] = $favicon;
if(isset($language)) $head['language'] = $language;
if(isset($css)) $head['css'] = $css;
if(isset($js)) $head['js'] = $js;
\Keyman\Site\com\keyman\templates\Head::render($head);
Expand Down
Loading