Skip to content

Commit e9caf21

Browse files
committed
feat(devtools): add meta description and default favicon styles
This commit enhances the SEO capabilities of the basic example by adding a meta description tag for improved search engine visibility. Additionally, it introduces new styles for a default favicon, ensuring a consistent visual representation when no favicon is provided. This improves user feedback in the SERP preview section.
1 parent f053469 commit e9caf21

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

examples/react/basic/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
<meta name="twitter:url" content="https://example.com/basic" />
2929
<script src="https://unpkg.com/react-scan/dist/auto.global.js"></script>
3030
<title>Basic Example - TanStack Devtools</title>
31+
<meta
32+
name="description"
33+
content="A basic example of using TanStack Devtools with React."
34+
/>
35+
3136
<description
3237
>A basic example of using TanStack Devtools with React.</description
3338
>

packages/devtools/src/styles/use-styles.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,22 @@ const stylesFactory = (theme: DevtoolsStore['settings']['theme']) => {
251251
border-radius: 50%;
252252
flex-shrink: 0;
253253
object-fit: contain;
254+
overflow: hidden;
255+
display: flex;
256+
align-items: center;
257+
justify-content: center;
258+
`,
259+
serpSnippetDefaultFavicon: css`
260+
width: 28px;
261+
height: 28px;
262+
background-color: ${t(colors.gray[200], colors.gray[800])};
263+
border-radius: 50%;
264+
flex-shrink: 0;
265+
object-fit: contain;
266+
overflow: hidden;
267+
display: flex;
268+
align-items: center;
269+
justify-content: center;
254270
`,
255271
serpSnippetSiteColumn: css`
256272
display: flex;

packages/devtools/src/tabs/seo-tab/serp-preview.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ function getSerpReports(data: SerpData, overflow: SerpOverflow): string[] {
7777
if (!data.description?.trim()) {
7878
issues.push('No meta description set on the page.')
7979
}
80+
if (!data.favicon) {
81+
issues.push('No favicon or icon set on the page.')
82+
}
8083
if (overflow.titleOverflow) {
8184
issues.push(
8285
'The title is wider than 600px and it may not be displayed in full length.',
@@ -157,7 +160,9 @@ export function SerpPreviewSection() {
157160
alt=""
158161
class={styles().serpSnippetFavicon}
159162
/>
160-
) : null}
163+
) : (
164+
<div class={styles().serpSnippetDefaultFavicon} />
165+
)}
161166
<div class={styles().serpSnippetSiteColumn}>
162167
<span class={styles().serpSnippetSiteName}>
163168
{data.siteName || data.url}

0 commit comments

Comments
 (0)