Skip to content

Commit c52e9df

Browse files
authored
Content - Site search: adding documentation (#2541)
1 parent d81cddc commit c52e9df

File tree

4 files changed

+196
-0
lines changed

4 files changed

+196
-0
lines changed

_data/sites.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3936,6 +3936,40 @@
39363936
}
39373937
]
39383938
}
3939+
,{
3940+
"@context": {
3941+
"@version": 1.1,
3942+
"dct": "http://purl.org/dc/terms/",
3943+
"title": { "@id": "dct:title", "@container": "@language" },
3944+
"description": { "@id": "dct:description", "@container": "@language" },
3945+
"modified": "dct:modified"
3946+
},
3947+
"title": {
3948+
"en": "Site search box",
3949+
"fr": "Champ de recherche du site"
3950+
},
3951+
"description": {
3952+
"en": "Documentation on how to implement the site search box.",
3953+
"fr": "Documentation sur l'implémentation du champ de recherche du site."
3954+
},
3955+
"modified": "2025-04-14",
3956+
"componentName": "search",
3957+
"status": "stable",
3958+
"pages": {
3959+
"docs": [
3960+
{
3961+
"title": "Site search box",
3962+
"language": "en",
3963+
"path": "search-doc-en.html"
3964+
},
3965+
{
3966+
"title": "Champ de recherche du site",
3967+
"language": "fr",
3968+
"path": "search-doc-fr.html"
3969+
}
3970+
]
3971+
}
3972+
}
39393973
,{
39403974
"@context": {
39413975
"@version": 2.0,

sites/search/index.json-ld

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"@context": {
3+
"@version": 1.1,
4+
"dct": "http://purl.org/dc/terms/",
5+
"title": { "@id": "dct:title", "@container": "@language" },
6+
"description": { "@id": "dct:description", "@container": "@language" },
7+
"modified": "dct:modified"
8+
},
9+
"title": {
10+
"en": "Site search box",
11+
"fr": "Champ de recherche du site"
12+
},
13+
"description": {
14+
"en": "Documentation on how to implement the site search box.",
15+
"fr": "Documentation sur l'implémentation du champ de recherche du site."
16+
},
17+
"modified": "2025-04-14",
18+
"componentName": "search",
19+
"status": "stable",
20+
"pages": {
21+
"docs": [
22+
{
23+
"title": "Site search box",
24+
"language": "en",
25+
"path": "search-doc-en.html"
26+
},
27+
{
28+
"title": "Champ de recherche du site",
29+
"language": "fr",
30+
"path": "search-doc-fr.html"
31+
}
32+
]
33+
}
34+
}

sites/search/search-doc-en.html

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
{
3+
"altLangPage": "search-doc-fr.html",
4+
"dateModified": "2025-04-14",
5+
"description": "Documentation on how to implement the site search box",
6+
"language": "en",
7+
"title": "Site search box"
8+
}
9+
---
10+
<span class="wb-prettify all-pre hide"></span>
11+
12+
<dl class="horizontal">
13+
<dt>Status</dt>
14+
<dd>Stable</dd>
15+
<dt>Type</dt>
16+
<dd>Canada.ca site functionality</dd>
17+
<dt>Last review</dt>
18+
<dd>2025-04-14</dd>
19+
<dt>Component version</dt>
20+
<dd>Version 1.0</dd>
21+
</dl>
22+
23+
<h2>Purpose</h2>
24+
<p>The site search box is an element of the global header. It allows people to search Government of Canada content using a simple search field.</p>
25+
<p>Results for site search are at the level of all Government of Canada web content, or a subset of content at the department or agency level.</p>
26+
27+
<h2>How to implement</h2>
28+
<p>Refer to the below code samples.</p>
29+
30+
<h3>Basic Site search box example</h3>
31+
<pre><code>&lt;section id="wb-srch" class="col-lg-offset-4 col-md-offset-4 col-sm-offset-2 col-xs-12 col-sm-5 col-md-4">
32+
&lt;h2>Search&lt;/h2>
33+
&lt;form action="#" method="post" name="cse-search-box" role="search">
34+
&lt;div class="form-group wb-srch-qry">
35+
&lt;label for="wb-srch-q" class="wb-inv">Search Canada.ca&lt;/label>
36+
&lt;input id="wb-srch-q" list="wb-srch-q-ac" class="wb-srch-q form-control" name="q" type="search" value="" size="34" maxlength="170" placeholder="Search Canada.ca" />
37+
&lt;datalist id="wb-srch-q-ac">&lt;/datalist>
38+
&lt;/div>
39+
&lt;div class="form-group submit">
40+
&lt;button type="submit" id="wb-srch-sub" class="btn btn-primary btn-small" name="wb-srch-sub">
41+
&lt;span class="glyphicon-search glyphicon">&lt;/span>
42+
&lt;span class="wb-inv">Search Canada.ca&lt;/span>
43+
&lt;/button>
44+
&lt;/div>
45+
&lt;/form>
46+
&lt;/section></code></pre>
47+
48+
<h3>Custom department Site search box example</h3>
49+
<pre><code>&lt;section id="wb-srch" class="col-lg-offset-4 col-md-offset-4 col-sm-offset-2 col-xs-12 col-sm-5 col-md-4">
50+
&lt;h2>Search&lt;/h2>
51+
&lt;form action="#" method="post" name="cse-search-box" role="search">
52+
&lt;div class="form-group wb-srch-qry">
53+
&lt;label for="wb-srch-q" class="wb-inv"><strong>Search [department/theme]</strong>&lt;/label>
54+
&lt;input id="wb-srch-q" list="wb-srch-q-ac" class="wb-srch-q form-control" name="q" type="search" value="" size="34" maxlength="170" placeholder="<strong>Search [department/theme]</strong>" />
55+
&lt;datalist id="wb-srch-q-ac">&lt;/datalist>
56+
&lt;/div>
57+
&lt;div class="form-group submit">
58+
&lt;button type="submit" id="wb-srch-sub" class="btn btn-primary btn-small" name="wb-srch-sub">
59+
&lt;span class="glyphicon-search glyphicon">&lt;/span>
60+
&lt;span class="wb-inv">Search&lt;/span>
61+
&lt;/button>
62+
&lt;/div>
63+
&lt;/form>
64+
&lt;/section></code></pre>

sites/search/search-doc-fr.html

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
{
3+
"altLangPage": "search-doc-en.html",
4+
"dateModified": "2025-04-14",
5+
"description": "Documentation sur l'implémentation du champ de recherche du site",
6+
"language": "fr",
7+
"title": "Champ de recherche du site"
8+
}
9+
---
10+
<div class="wb-prettify all-pre hide"></div>
11+
12+
<dl class="horizontal">
13+
<dt>Statut</dt>
14+
<dd>Stable</dd>
15+
<dt>Type</dt>
16+
<dd>Fonctionnalité du site Canada.ca</dd>
17+
<dt>Dernière révision</dt>
18+
<dd>2025-04-14</dd>
19+
<dt>Version de la composante</dt>
20+
<dd>Version 1.0</dd>
21+
</dl>
22+
23+
<h2>Objectif</h2>
24+
<p>Le champ de recherche du site est un élément de l’en-tête général. Il permet aux gens de lancer une recherche dans le contenu du gouvernement du Canada au moyen d’un champ de recherche simple.</p>
25+
<p>Les résultats de la recherche dans le site sont présentés pour l’ensemble du contenu Web du gouvernement du Canada ou pour un sous-ensemble de contenu au niveau du ministère ou de l’organisme.</p>
26+
27+
<h2>Comment mettre en œuvre</h2>
28+
<p>Veuillez vous référer aux exemples de code ci-dessous.</p>
29+
30+
<h3>Exemple de base du champ de recherche du site</h3>
31+
<pre><code>&lt;section id="wb-srch" class="col-lg-offset-4 col-md-offset-4 col-sm-offset-2 col-xs-12 col-sm-5 col-md-4">
32+
&lt;h2>Recherche&lt;/h2>
33+
&lt;form action="#" method="post" name="cse-search-box" role="search">
34+
&lt;div class="form-group wb-srch-qry">
35+
&lt;label for="wb-srch-q" class="wb-inv">Rechercher dans Canada.ca&lt;/label>
36+
&lt;input id="wb-srch-q" list="wb-srch-q-ac" class="wb-srch-q form-control" name="q" type="search" value="" size="34" maxlength="170" placeholder="Rechercher dans Canada.ca" />
37+
&lt;datalist id="wb-srch-q-ac">&lt;/datalist>
38+
&lt;/div>
39+
&lt;div class="form-group submit">
40+
&lt;button type="submit" id="wb-srch-sub" class="btn btn-primary btn-small" name="wb-srch-sub">
41+
&lt;span class="glyphicon-search glyphicon">&lt;/span>
42+
&lt;span class="wb-inv">Recherche&lt;/span>
43+
&lt;/button>
44+
&lt;/div>
45+
&lt;/form>
46+
&lt;/section></code></pre>
47+
48+
<h3>Exemple de recherche personnalisée du champ de recherche du site</h3>
49+
<pre><code>&lt;section id="wb-srch" class="col-lg-offset-4 col-md-offset-4 col-sm-offset-2 col-xs-12 col-sm-5 col-md-4">
50+
&lt;h2>Recherche&lt;/h2>
51+
&lt;form action="#" method="post" name="cse-search-box" role="search">
52+
&lt;div class="form-group wb-srch-qry">
53+
&lt;label for="wb-srch-q" class="wb-inv"><strong>Rechercher dans [département/thème]</strong>&lt;/label>
54+
&lt;input id="wb-srch-q" list="wb-srch-q-ac" class="wb-srch-q form-control" name="q" type="search" value="" size="34" maxlength="170" placeholder="<strong>Rechercher dans [département/thème]</strong>" />
55+
&lt;datalist id="wb-srch-q-ac">&lt;/datalist>
56+
&lt;/div>
57+
&lt;div class="form-group submit">
58+
&lt;button type="submit" id="wb-srch-sub" class="btn btn-primary btn-small" name="wb-srch-sub">
59+
&lt;span class="glyphicon-search glyphicon">&lt;/span>
60+
&lt;span class="wb-inv">Recherche&lt;/span>
61+
&lt;/button>
62+
&lt;/div>
63+
&lt;/form>
64+
&lt;/section></code></pre>

0 commit comments

Comments
 (0)