Skip to content

Commit

Permalink
i18n(hi): update site-search.mdx (#1331)
Browse files Browse the repository at this point in the history
  • Loading branch information
at-the-vr authored Jan 4, 2024
1 parent 078a1ca commit 2eb70d3
Showing 1 changed file with 166 additions and 0 deletions.
166 changes: 166 additions & 0 deletions docs/src/content/docs/hi/guides/site-search.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
---
title: साइट खोज
description: Starlight की अंतर्निहित साइट खोज सुविधाओं और उन्हें अनुकूलित करने के तरीके के बारे में जानें।
sidebar:
badge: नया
---

import { Tabs, TabItem } from '@astrojs/starlight/components';

डिफ़ॉल्ट रूप से, Starlight साइटों में [Pagefind](https://pagefind.app/) द्वारा संचालित पूर्ण-पाठ खोज शामिल होती है, जो स्थिर साइटों के लिए एक तेज़ और कम बैंडविड्थ वाला खोज उपकरण है।

खोज को सक्षम करने के लिए किसी कॉन्फ़िगरेशन की आवश्यकता नहीं है. अपनी साइट बनाएं और तैनात करें, फिर कंटेंट ढूंढने के लिए साइट हेडर में खोज बार का उपयोग करें।

## खोज परिणामों में कंटेंट छिपाएँ

### एक पेज को बाहर निकालें

किसी पेज को अपने खोज अनुक्रमणिका से बाहर करने के लिए, पेज के फ्रंटमैटर में [`pagefind: false`](/hi/reference/frontmatter/#pagefind) जोड़ें:

```md title="src/content/docs/not-indexed.md" ins={3}
---
title: खोज से छिपाने के लिए कंटेंट
pagefind: false
---
```

### किसी पेज का भाग बाहर निकालें

Pagefind [`data-pagefind-ignore`](https://pagefind.app/docs/indexing/#removing-individual-elements-from-the-index) विशेषता वाले तत्व के अंदर के कंटेंट को अनदेखा कर देगा।

निम्नलिखित उदाहरण में, पहला अनुच्छेद खोज परिणामों में प्रदर्शित होगा, लेकिन `<div>` के कंटेंट नहीं दिखाई देंगे:

```md title="src/content/docs/partially-indexed.md" ins="data-pagefind-ignore"
---
title: आंशिक रूप से अनुक्रमित पेज
---

यह पाठ खोज के माध्यम से खोजा जा सकेगा.

<div data-pagefind-ignore>

यह पाठ खोज से छिपा दिया जाएगा.

</div>
```

## वैकल्पिक खोज प्रदाता

### Algolia DocSearch

यदि आपके पास [Algolia’s DocSearch program](https://docsearch.algolia.com/) की पहुंच है और आप Pagefind के बजाय इसका उपयोग करना चाहते हैं, तो आप आधिकारिक Starlight DocSearch प्लगइन का उपयोग कर सकते हैं।

1. `@astrojs/starlight-docsearch` इंस्टॉल करें:

<Tabs>

<TabItem label="npm">

```sh
npm install @astrojs/starlight-docsearch
```

</TabItem>

<TabItem label="pnpm">

```sh
pnpm add @astrojs/starlight-docsearch
```

</TabItem>

<TabItem label="Yarn">

```sh
yarn add @astrojs/starlight-docsearch
```

</TabItem>

</Tabs>

2. DocSearch को `astro.config.mjs` में अपने Starlight [`प्लगइन`](/hi/reference/configuration/#plugins) कॉन्फिगरेशन में जोड़ें और इसे अपना Algolia `appId`, `apiKey` और `indexName` पास करें:

```js ins={4,10-16}
// astro.config.mjs
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import starlightDocSearch from '@astrojs/starlight-docsearch';

export default defineConfig({
integrations: [
starlight({
title: 'DocSearch वाली साइट',
plugins: [
starlightDocSearch({
appId: 'YOUR_APP_ID',
apiKey: 'YOUR_SEARCH_API_KEY',
indexName: 'YOUR_INDEX_NAME',
}),
],
}),
],
});
```

इस अद्यतन कॉन्फ़िगरेशन के साथ, आपकी साइट पर खोज बार अब डिफ़ॉल्ट खोज मोडल के बजाय एक अल्गोलिया मोडल खोलेगा।

#### DocSearch UI का अनुवाद कैसे करे

DocSearch डिफ़ॉल्ट रूप से केवल अंग्रेज़ी UI स्ट्रिंग्स प्रदान करता है।
Starlight की अंतर्निहित [अंतर्राष्ट्रीयकरण प्रणाली](/hi/guides/i18n/#translate-starlights-ui) का उपयोग करके अपनी भाषा के लिए मोडल UI का अनुवाद जोड़ें।

1. `src/content/config.ts` में DocSearch schema के साथ Starlight की `i18n` सामग्री संग्रह परिभाषा का विस्तार करें:

```js ins={4} ins=/{ extend: .+ }/
// src/content/config.ts
import { defineCollection } from 'astro:content';
import { docsSchema, i18nSchema } from '@astrojs/starlight/schema';
import { docSearchI18nSchema } from '@astrojs/starlight-docsearch/schema';

export const collections = {
docs: defineCollection({ schema: docsSchema() }),
i18n: defineCollection({
type: 'data',
schema: i18nSchema({ extend: docSearchI18nSchema() }),
}),
};
```

2. अपनी JSON फ़ाइलों में `src/content/i18n/` में अनुवाद जोड़ें।

ये DocSearch द्वारा उपयोग किए जाने वाले अंग्रेजी डिफ़ॉल्ट हैं:

```json title="src/content/i18n/en.json"
{
"docsearch.searchBox.resetButtonTitle": "Clear the query",
"docsearch.searchBox.resetButtonAriaLabel": "Clear the query",
"docsearch.searchBox.cancelButtonText": "Cancel",
"docsearch.searchBox.cancelButtonAriaLabel": "Cancel",

"docsearch.startScreen.recentSearchesTitle": "Recent",
"docsearch.startScreen.noRecentSearchesText": "No recent searches",
"docsearch.startScreen.saveRecentSearchButtonTitle": "Save this search",
"docsearch.startScreen.removeRecentSearchButtonTitle": "Remove this search from history",
"docsearch.startScreen.favoriteSearchesTitle": "Favorite",
"docsearch.startScreen.removeFavoriteSearchButtonTitle": "Remove this search from favorites",

"docsearch.errorScreen.titleText": "Unable to fetch results",
"docsearch.errorScreen.helpText": "You might want to check your network connection.",

"docsearch.footer.selectText": "to select",
"docsearch.footer.selectKeyAriaLabel": "Enter key",
"docsearch.footer.navigateText": "to navigate",
"docsearch.footer.navigateUpKeyAriaLabel": "Arrow up",
"docsearch.footer.navigateDownKeyAriaLabel": "Arrow down",
"docsearch.footer.closeText": "to close",
"docsearch.footer.closeKeyAriaLabel": "Escape key",
"docsearch.footer.searchByText": "Search by",

"docsearch.noResultsScreen.noResultsText": "No results for",
"docsearch.noResultsScreen.suggestedQueryText": "Try searching for",
"docsearch.noResultsScreen.reportMissingResultsText": "Believe this query should return results?",
"docsearch.noResultsScreen.reportMissingResultsLinkText": "Let us know."
}
```

0 comments on commit 2eb70d3

Please sign in to comment.