Skip to content

Commit 5ef964b

Browse files
committed
Move top-bar into Lit templates so it SSRs
1 parent d70a2dc commit 5ef964b

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

packages/site-content/site/_includes/layouts/base.11ty.cjs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ module.exports = {
99
const {renderPage} = await import(
1010
'@webcomponents/internal-site-server/lib/templates/base.js'
1111
);
12-
return [...renderPage(data)].join('');
12+
// TODO (justinfagnani): move the top-bar to a real template or
13+
// back into the base template when we enable 11ty / Lit SSR integration
14+
return [
15+
...renderPage({
16+
...data,
17+
content: `
18+
<wco-top-bar></wco-top-bar>
19+
${data.content}
20+
`,
21+
}),
22+
].join('');
1323
},
1424
};

packages/site-server/src/catalog/routes/catalog/catalog-route.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const handleCatalogRoute = async (
2222
'/js/catalog.js'
2323
],
2424
content: `
25+
<wco-top-bar></wco-top-bar>
2526
<h1>Catalog</h1>
2627
<wco-catalog-search></wco-catalog-search>
2728
`,

packages/site-server/src/catalog/routes/element/element-route.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {Readable} from 'stream';
88
import {gql} from '@apollo/client/core/index.js';
99
import Router from '@koa/router';
1010
import {render} from '@lit-labs/ssr/lib/render-with-global-dom-shim.js';
11-
import '@webcomponents/internal-site-client/lib/entrypoints/element.js';
1211

1312
import {renderPage} from '../../../templates/base.js';
1413
import {client} from '../../graphql.js';

packages/site-server/src/catalog/routes/element/element-template.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
resolveReference,
1313
normalizeModulePath,
1414
} from '@webcomponents/custom-elements-manifest-tools';
15+
import '@webcomponents/internal-site-client/lib/entrypoints/element.js';
1516

1617
export const renderElement = ({
1718
packageName,
@@ -57,6 +58,7 @@ export const renderElement = ({
5758
}
5859

5960
return html`
61+
<wco-top-bar></wco-top-bar>
6062
<h1>${packageName}/${elementName}</h1>
6163
${declaration.description}
6264
<h2>Usage</h2>

packages/site-server/src/templates/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function* renderPage(data: {
5252
<title>${escapeHTML(data.title)}</title>
5353
</head>
5454
<body>
55-
<wco-top-bar></wco-top-bar>`;
55+
`;
5656
if (typeof data.content === 'string') {
5757
yield data.content;
5858
} else {

0 commit comments

Comments
 (0)