diff --git a/NEWS.md b/NEWS.md
index eeefa08547..f7e645adca 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,7 @@
# pkgdown (development version)
+* New translation for "Search site", the label applied to the search box for screenreaders. This was previously incorrectly labelled as "Toggle navigation" (#2320).
+* You can now choose where the search box is placed with the "search" navbar component. This has been documented for a very long time, but as far as I can tell, never worked (#2320). If you have made your own template with a custom `navbar`, you will need to remove the `
-
-
-
{{#right}}
{{{.}}}
diff --git a/po/R-pkgdown.pot b/po/R-pkgdown.pot
index 1ef8eb7495..0d1831ad77 100644
--- a/po/R-pkgdown.pot
+++ b/po/R-pkgdown.pot
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: pkgdown 2.0.9.9000\n"
-"POT-Creation-Date: 2024-04-18 17:22-0500\n"
+"POT-Creation-Date: 2024-04-19 08:40-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -18,7 +18,7 @@ msgstr ""
msgid "Content not found. Please use links in the navbar."
msgstr ""
-#: build-articles.R:395 navbar.R:142 navbar.R:149 navbar.R:164
+#: build-articles.R:395 navbar.R:147 navbar.R:154 navbar.R:169
msgid "Articles"
msgstr ""
@@ -42,7 +42,7 @@ msgstr ""
msgid "Developers"
msgstr ""
-#: build-home-authors.R:77 render.R:96
+#: build-home-authors.R:77 render.R:95
msgid "Authors"
msgstr ""
@@ -90,7 +90,7 @@ msgstr ""
msgid "translator"
msgstr ""
-#: build-home-citation.R:37 build-home-citation.R:94 render.R:99
+#: build-home-citation.R:37 build-home-citation.R:94 render.R:98
msgid "Citation"
msgstr ""
@@ -182,7 +182,7 @@ msgstr ""
msgid "Usage"
msgstr ""
-#: build-tutorials.R:46 navbar.R:108
+#: build-tutorials.R:46 navbar.R:113
msgid "Tutorials"
msgstr ""
@@ -202,14 +202,22 @@ msgstr ""
msgid "Reference"
msgstr ""
-#: navbar.R:136
+#: navbar.R:141
msgid "Get started"
msgstr ""
-#: navbar.R:162
+#: navbar.R:167
msgid "More articles..."
msgstr ""
+#: navbar.R:208
+msgid "Search site"
+msgstr ""
+
+#: navbar.R:209
+msgid "Search for"
+msgstr ""
+
#: rd-data.R:33
msgid "Details"
msgstr ""
@@ -222,7 +230,7 @@ msgstr ""
msgid "References"
msgstr ""
-#: rd-data.R:45 render.R:94
+#: rd-data.R:45 render.R:93
msgid "Source"
msgstr ""
@@ -263,22 +271,18 @@ msgid "Toggle navigation"
msgstr ""
#: render.R:92
-msgid "Search for"
-msgstr ""
-
-#: render.R:93
msgid "On this page"
msgstr ""
-#: render.R:95
+#: render.R:94
msgid "Abstract"
msgstr ""
-#: render.R:97
+#: render.R:96
msgid "Version"
msgstr ""
-#: render.R:98
+#: render.R:97
msgid "Examples"
msgstr ""
diff --git a/tests/testthat/_snaps/navbar.md b/tests/testthat/_snaps/navbar.md
index 552e2a765a..4d5e09094a 100644
--- a/tests/testthat/_snaps/navbar.md
+++ b/tests/testthat/_snaps/navbar.md
@@ -3,6 +3,8 @@
reference:
text: Reference
href: reference/index.html
+ search:
+ search: ~
---
@@ -10,6 +12,8 @@
reference:
text: Reference
href: reference/index.html
+ search:
+ search: ~
github:
icon: fab fa-github fa-lg
href: https://github.com/r-lib/pkgdown
@@ -21,6 +25,8 @@
reference:
text: Reference
href: reference/index.html
+ search:
+ search: ~
github:
icon: fab fa-gitlab fa-lg
href: https://gitlab.com/r-lib/pkgdown
@@ -32,6 +38,8 @@
reference:
text: Reference
href: reference/index.html
+ search:
+ search: ~
intro:
text: Get started
href: test.html
@@ -127,16 +135,13 @@
# data_navbar() can re-order default elements
Code
- data_navbar(pkg)
+ data_navbar(pkg)[c("left", "right")]
Output
- $type
- [1] "default"
-
$left
- [1] "\n \n \n \n \n \n\n Reference \n "
+ [1] "\n \n \n \n \n \n\n \n "
$right
- [1] "\n Changelog \n "
+ [1] "\n Changelog \n "
# data_navbar() can remove elements
@@ -282,3 +287,12 @@
Output
text
+# can render search helper
+
+ Code
+ bs4_navbar_links_tags(list(menu = list(search = TRUE)))
+ Output
+
+
+
+
diff --git a/tests/testthat/_snaps/render.md b/tests/testthat/_snaps/render.md
index 3fe6c6d9a6..f929222eec 100644
--- a/tests/testthat/_snaps/render.md
+++ b/tests/testthat/_snaps/render.md
@@ -23,7 +23,6 @@
translate:
skip: Skip to contents
toggle_nav: Toggle navigation
- search_for: Search for
on_this_page: On this page
source: Source
abstract: Abstract
diff --git a/tests/testthat/test-navbar.R b/tests/testthat/test-navbar.R
index c97f2bb851..89dd6a405f 100644
--- a/tests/testthat/test-navbar.R
+++ b/tests/testthat/test-navbar.R
@@ -82,18 +82,20 @@ test_that("data_navbar() works by default", {
test_that("data_navbar() can re-order default elements", {
pkg <- local_pkgdown_site(meta = "
+ template:
+ bootstrap: 5
repo:
url:
home: https://github.com/r-lib/pkgdown/
navbar:
structure:
- left: [github, reference]
- right: news
+ left: [github, search]
+ right: [news]
")
file.create(file.path(pkg$src_path, "NEWS.md"))
- expect_snapshot(data_navbar(pkg))
+ expect_snapshot(data_navbar(pkg)[c("left", "right")])
})
test_that("data_navbar() can remove elements", {
@@ -208,3 +210,9 @@ test_that("can specific link target", {
)
})
})
+
+test_that("can render search helper", {
+ expect_snapshot({
+ bs4_navbar_links_tags(list(menu = list(search = TRUE)))
+ })
+})
\ No newline at end of file