Skip to content

Commit

Permalink
Fix to allow specification of html lang #56
Browse files Browse the repository at this point in the history
  • Loading branch information
qrac committed Jun 28, 2022
1 parent 3788484 commit 8b953a7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "minista",
"description": "Next.js Like Development with 100% Static Generate",
"version": "2.8.0",
"version": "2.8.1",
"bin": {
"minista": "./bin/minista.js"
},
Expand Down
8 changes: 7 additions & 1 deletion src/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ export async function renderHtml(
const staticHelmet = (data: string) => {
return data.replace(/data-react-helmet="true"/g, "")
}
const htmlAttributes = Object.hasOwn(
helmet.htmlAttributes.toComponent(),
"lang"
)
? helmet.htmlAttributes.toString()
: `lang="ja" ${helmet.htmlAttributes.toString()}`
return `
<!doctype html>
<html lang="ja" ${helmet.htmlAttributes.toString()}>
<html ${htmlAttributes}>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Expand Down
3 changes: 3 additions & 0 deletions user/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const PageHome = () => {
<li>
<a href="/about/">About</a>
</li>
<li>
<a href="/lang/">Lang</a>
</li>
<li>
<a href="/entry/">Entry</a>
</li>
Expand Down
14 changes: 14 additions & 0 deletions user/src/pages/lang/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Head } from "minista"

const PageLang = () => {
return (
<>
<Head htmlAttributes={{ lang: "en" }}>
<title>Lang</title>
</Head>
<h1>Lang</h1>
</>
)
}

export default PageLang

0 comments on commit 8b953a7

Please sign in to comment.