Skip to content

Commit

Permalink
fix: Handle optional language tag in header
Browse files Browse the repository at this point in the history
Fixes: KEYMAN-COM-1CX
  • Loading branch information
darcywong00 committed Nov 4, 2024
1 parent 64bfdfd commit 7b2d69c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
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

0 comments on commit 7b2d69c

Please sign in to comment.