Can I use a friendly URL on SearchAction?
My current URL for searches is this one:
https://example.com/search/key/seach_word_here
JSON-LD
<script type='application/ld+json'>
[
{
"@context":"http://schema.org",
"@type":"WebSite",
"@id":"#website",
"url":"https://example.com",
"name":"Example",
"potentialAction":{
"@type":"SearchAction",
"target":"https:https://example.com/search/key/{search_term_string}",
"query-input":"required name=search_term_string"
}
},
{
"@context":"http://schema.org",
"@type":"Organization",
"url": "https://example.com",
"name": "Example",
"logo":"https://example.com/img/logo.png",
"@id":"#organization",
"sameAs": ["https://www.facebook.com/example"]
}
]
</script>
As you can see I'm using a friendly URL on the target
.
I have seen people using a query string on the URL like this:
https://example.com/?search={search_term_string}
I did not see people using a friendly URL on the target
. It's not allowed?
And at https://developers.google.com/search/docs/data-types/sitelinks-searchbox it says:
Verify your search engine implementation by copying the WebSite.potentialAction.target URL from your structured data, replacing search_term_string with a test query, and browsing to that URL in a web browser. For example, if your website is example.com, and you want to test the query "kittens", you would browse to
https://www.example.com/search/?q={kittens}
.
I tested this url https://example.com/search/hey/{search_word_here}
and I got a 404 not found, but this URL worked: https://example.com/?p=search&tp=key&word={search_word_here}
.
So my question is: Can I use a friendly URL on the target
? And the code on my snippet is correct?
url schema.org google-sitelink-searchbox
add a comment |
My current URL for searches is this one:
https://example.com/search/key/seach_word_here
JSON-LD
<script type='application/ld+json'>
[
{
"@context":"http://schema.org",
"@type":"WebSite",
"@id":"#website",
"url":"https://example.com",
"name":"Example",
"potentialAction":{
"@type":"SearchAction",
"target":"https:https://example.com/search/key/{search_term_string}",
"query-input":"required name=search_term_string"
}
},
{
"@context":"http://schema.org",
"@type":"Organization",
"url": "https://example.com",
"name": "Example",
"logo":"https://example.com/img/logo.png",
"@id":"#organization",
"sameAs": ["https://www.facebook.com/example"]
}
]
</script>
As you can see I'm using a friendly URL on the target
.
I have seen people using a query string on the URL like this:
https://example.com/?search={search_term_string}
I did not see people using a friendly URL on the target
. It's not allowed?
And at https://developers.google.com/search/docs/data-types/sitelinks-searchbox it says:
Verify your search engine implementation by copying the WebSite.potentialAction.target URL from your structured data, replacing search_term_string with a test query, and browsing to that URL in a web browser. For example, if your website is example.com, and you want to test the query "kittens", you would browse to
https://www.example.com/search/?q={kittens}
.
I tested this url https://example.com/search/hey/{search_word_here}
and I got a 404 not found, but this URL worked: https://example.com/?p=search&tp=key&word={search_word_here}
.
So my question is: Can I use a friendly URL on the target
? And the code on my snippet is correct?
url schema.org google-sitelink-searchbox
add a comment |
My current URL for searches is this one:
https://example.com/search/key/seach_word_here
JSON-LD
<script type='application/ld+json'>
[
{
"@context":"http://schema.org",
"@type":"WebSite",
"@id":"#website",
"url":"https://example.com",
"name":"Example",
"potentialAction":{
"@type":"SearchAction",
"target":"https:https://example.com/search/key/{search_term_string}",
"query-input":"required name=search_term_string"
}
},
{
"@context":"http://schema.org",
"@type":"Organization",
"url": "https://example.com",
"name": "Example",
"logo":"https://example.com/img/logo.png",
"@id":"#organization",
"sameAs": ["https://www.facebook.com/example"]
}
]
</script>
As you can see I'm using a friendly URL on the target
.
I have seen people using a query string on the URL like this:
https://example.com/?search={search_term_string}
I did not see people using a friendly URL on the target
. It's not allowed?
And at https://developers.google.com/search/docs/data-types/sitelinks-searchbox it says:
Verify your search engine implementation by copying the WebSite.potentialAction.target URL from your structured data, replacing search_term_string with a test query, and browsing to that URL in a web browser. For example, if your website is example.com, and you want to test the query "kittens", you would browse to
https://www.example.com/search/?q={kittens}
.
I tested this url https://example.com/search/hey/{search_word_here}
and I got a 404 not found, but this URL worked: https://example.com/?p=search&tp=key&word={search_word_here}
.
So my question is: Can I use a friendly URL on the target
? And the code on my snippet is correct?
url schema.org google-sitelink-searchbox
My current URL for searches is this one:
https://example.com/search/key/seach_word_here
JSON-LD
<script type='application/ld+json'>
[
{
"@context":"http://schema.org",
"@type":"WebSite",
"@id":"#website",
"url":"https://example.com",
"name":"Example",
"potentialAction":{
"@type":"SearchAction",
"target":"https:https://example.com/search/key/{search_term_string}",
"query-input":"required name=search_term_string"
}
},
{
"@context":"http://schema.org",
"@type":"Organization",
"url": "https://example.com",
"name": "Example",
"logo":"https://example.com/img/logo.png",
"@id":"#organization",
"sameAs": ["https://www.facebook.com/example"]
}
]
</script>
As you can see I'm using a friendly URL on the target
.
I have seen people using a query string on the URL like this:
https://example.com/?search={search_term_string}
I did not see people using a friendly URL on the target
. It's not allowed?
And at https://developers.google.com/search/docs/data-types/sitelinks-searchbox it says:
Verify your search engine implementation by copying the WebSite.potentialAction.target URL from your structured data, replacing search_term_string with a test query, and browsing to that URL in a web browser. For example, if your website is example.com, and you want to test the query "kittens", you would browse to
https://www.example.com/search/?q={kittens}
.
I tested this url https://example.com/search/hey/{search_word_here}
and I got a 404 not found, but this URL worked: https://example.com/?p=search&tp=key&word={search_word_here}
.
So my question is: Can I use a friendly URL on the target
? And the code on my snippet is correct?
url schema.org google-sitelink-searchbox
url schema.org google-sitelink-searchbox
edited Jan 18 at 17:23
unor
66.1k17139243
66.1k17139243
asked Jan 18 at 6:27
NatalieNatalie
727
727
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Of course you have to use the URL that works.
Google will use the target
URL for their Sitelink Searchbox, so that users can search on Google’s SERP and end up on your internal SERP. If you specify a target
URL that leads to 404 pages, having this feature makes no sense, and Google would have no interest to enable it for your results.
If that URL happens to be friendly (e.g., without a query component), so be it.
does thetarget
URL really needs to work with{}
? I got the 404 if i put this on the friendly url
– Natalie
Jan 18 at 19:08
@Natalie: Ah, I see. No, you have to replace the string including the{}
. That part from the Google quote is misleading/wrong. So from your example, you should testhttps://example.com/search/key/kittens
in the browser.
– unor
Jan 19 at 3:22
Got it, so mytarget
andquery-input
on the snippet is correct? or should i replacesearch_term_string
for something else?
– Natalie
Jan 19 at 17:48
@Natalie: Apart from the double "https", it seems to be fine (assuming thathttps://example.com/search/key/kittens
works).
– unor
Jan 19 at 20:57
add a comment |
Agree with above solution from @unor, now answering about you code correction
Please check the target url in posted JSON-LD:-
"target":"https:https://example.com/search/key/{search_term_string}",
Remove the double https:
Also in case of JSON-LD: you cannot map name value to /{search_term_string}
A correct way is always like this:-
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "[website url]",
"potentialAction": {
"@type": "SearchAction",
"target": "[website search url]={search_term}",
"query-input": "required name=search_term"
}
}
</script>
Microdata:-
<div itemscope itemtype="http://schema.org/WebSite">
<meta itemprop="url" content="[website url]"/>
<form itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction">
<meta itemprop="target" content="[website search url]={search_term}"/>
<input itemprop="query-input" type="text" name="search_term">
<input type="submit">
</form>
</div>
How should i change this line?"target": "[website search url]={search_term}"
i got this error on google structured data testing toolINVALID_SYNTAX
.
– Natalie
Jan 18 at 19:12
@Natalie in that target you have to code for example test like this:-"target": "https://pinterest.com/search?q={test}",
"query-input": "required name=test"
– Deepender
Jan 19 at 9:51
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54248725%2fcan-i-use-a-friendly-url-on-searchaction%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Of course you have to use the URL that works.
Google will use the target
URL for their Sitelink Searchbox, so that users can search on Google’s SERP and end up on your internal SERP. If you specify a target
URL that leads to 404 pages, having this feature makes no sense, and Google would have no interest to enable it for your results.
If that URL happens to be friendly (e.g., without a query component), so be it.
does thetarget
URL really needs to work with{}
? I got the 404 if i put this on the friendly url
– Natalie
Jan 18 at 19:08
@Natalie: Ah, I see. No, you have to replace the string including the{}
. That part from the Google quote is misleading/wrong. So from your example, you should testhttps://example.com/search/key/kittens
in the browser.
– unor
Jan 19 at 3:22
Got it, so mytarget
andquery-input
on the snippet is correct? or should i replacesearch_term_string
for something else?
– Natalie
Jan 19 at 17:48
@Natalie: Apart from the double "https", it seems to be fine (assuming thathttps://example.com/search/key/kittens
works).
– unor
Jan 19 at 20:57
add a comment |
Of course you have to use the URL that works.
Google will use the target
URL for their Sitelink Searchbox, so that users can search on Google’s SERP and end up on your internal SERP. If you specify a target
URL that leads to 404 pages, having this feature makes no sense, and Google would have no interest to enable it for your results.
If that URL happens to be friendly (e.g., without a query component), so be it.
does thetarget
URL really needs to work with{}
? I got the 404 if i put this on the friendly url
– Natalie
Jan 18 at 19:08
@Natalie: Ah, I see. No, you have to replace the string including the{}
. That part from the Google quote is misleading/wrong. So from your example, you should testhttps://example.com/search/key/kittens
in the browser.
– unor
Jan 19 at 3:22
Got it, so mytarget
andquery-input
on the snippet is correct? or should i replacesearch_term_string
for something else?
– Natalie
Jan 19 at 17:48
@Natalie: Apart from the double "https", it seems to be fine (assuming thathttps://example.com/search/key/kittens
works).
– unor
Jan 19 at 20:57
add a comment |
Of course you have to use the URL that works.
Google will use the target
URL for their Sitelink Searchbox, so that users can search on Google’s SERP and end up on your internal SERP. If you specify a target
URL that leads to 404 pages, having this feature makes no sense, and Google would have no interest to enable it for your results.
If that URL happens to be friendly (e.g., without a query component), so be it.
Of course you have to use the URL that works.
Google will use the target
URL for their Sitelink Searchbox, so that users can search on Google’s SERP and end up on your internal SERP. If you specify a target
URL that leads to 404 pages, having this feature makes no sense, and Google would have no interest to enable it for your results.
If that URL happens to be friendly (e.g., without a query component), so be it.
answered Jan 18 at 17:37
unorunor
66.1k17139243
66.1k17139243
does thetarget
URL really needs to work with{}
? I got the 404 if i put this on the friendly url
– Natalie
Jan 18 at 19:08
@Natalie: Ah, I see. No, you have to replace the string including the{}
. That part from the Google quote is misleading/wrong. So from your example, you should testhttps://example.com/search/key/kittens
in the browser.
– unor
Jan 19 at 3:22
Got it, so mytarget
andquery-input
on the snippet is correct? or should i replacesearch_term_string
for something else?
– Natalie
Jan 19 at 17:48
@Natalie: Apart from the double "https", it seems to be fine (assuming thathttps://example.com/search/key/kittens
works).
– unor
Jan 19 at 20:57
add a comment |
does thetarget
URL really needs to work with{}
? I got the 404 if i put this on the friendly url
– Natalie
Jan 18 at 19:08
@Natalie: Ah, I see. No, you have to replace the string including the{}
. That part from the Google quote is misleading/wrong. So from your example, you should testhttps://example.com/search/key/kittens
in the browser.
– unor
Jan 19 at 3:22
Got it, so mytarget
andquery-input
on the snippet is correct? or should i replacesearch_term_string
for something else?
– Natalie
Jan 19 at 17:48
@Natalie: Apart from the double "https", it seems to be fine (assuming thathttps://example.com/search/key/kittens
works).
– unor
Jan 19 at 20:57
does the
target
URL really needs to work with {}
? I got the 404 if i put this on the friendly url– Natalie
Jan 18 at 19:08
does the
target
URL really needs to work with {}
? I got the 404 if i put this on the friendly url– Natalie
Jan 18 at 19:08
@Natalie: Ah, I see. No, you have to replace the string including the
{}
. That part from the Google quote is misleading/wrong. So from your example, you should test https://example.com/search/key/kittens
in the browser.– unor
Jan 19 at 3:22
@Natalie: Ah, I see. No, you have to replace the string including the
{}
. That part from the Google quote is misleading/wrong. So from your example, you should test https://example.com/search/key/kittens
in the browser.– unor
Jan 19 at 3:22
Got it, so my
target
and query-input
on the snippet is correct? or should i replace search_term_string
for something else?– Natalie
Jan 19 at 17:48
Got it, so my
target
and query-input
on the snippet is correct? or should i replace search_term_string
for something else?– Natalie
Jan 19 at 17:48
@Natalie: Apart from the double "https", it seems to be fine (assuming that
https://example.com/search/key/kittens
works).– unor
Jan 19 at 20:57
@Natalie: Apart from the double "https", it seems to be fine (assuming that
https://example.com/search/key/kittens
works).– unor
Jan 19 at 20:57
add a comment |
Agree with above solution from @unor, now answering about you code correction
Please check the target url in posted JSON-LD:-
"target":"https:https://example.com/search/key/{search_term_string}",
Remove the double https:
Also in case of JSON-LD: you cannot map name value to /{search_term_string}
A correct way is always like this:-
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "[website url]",
"potentialAction": {
"@type": "SearchAction",
"target": "[website search url]={search_term}",
"query-input": "required name=search_term"
}
}
</script>
Microdata:-
<div itemscope itemtype="http://schema.org/WebSite">
<meta itemprop="url" content="[website url]"/>
<form itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction">
<meta itemprop="target" content="[website search url]={search_term}"/>
<input itemprop="query-input" type="text" name="search_term">
<input type="submit">
</form>
</div>
How should i change this line?"target": "[website search url]={search_term}"
i got this error on google structured data testing toolINVALID_SYNTAX
.
– Natalie
Jan 18 at 19:12
@Natalie in that target you have to code for example test like this:-"target": "https://pinterest.com/search?q={test}",
"query-input": "required name=test"
– Deepender
Jan 19 at 9:51
add a comment |
Agree with above solution from @unor, now answering about you code correction
Please check the target url in posted JSON-LD:-
"target":"https:https://example.com/search/key/{search_term_string}",
Remove the double https:
Also in case of JSON-LD: you cannot map name value to /{search_term_string}
A correct way is always like this:-
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "[website url]",
"potentialAction": {
"@type": "SearchAction",
"target": "[website search url]={search_term}",
"query-input": "required name=search_term"
}
}
</script>
Microdata:-
<div itemscope itemtype="http://schema.org/WebSite">
<meta itemprop="url" content="[website url]"/>
<form itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction">
<meta itemprop="target" content="[website search url]={search_term}"/>
<input itemprop="query-input" type="text" name="search_term">
<input type="submit">
</form>
</div>
How should i change this line?"target": "[website search url]={search_term}"
i got this error on google structured data testing toolINVALID_SYNTAX
.
– Natalie
Jan 18 at 19:12
@Natalie in that target you have to code for example test like this:-"target": "https://pinterest.com/search?q={test}",
"query-input": "required name=test"
– Deepender
Jan 19 at 9:51
add a comment |
Agree with above solution from @unor, now answering about you code correction
Please check the target url in posted JSON-LD:-
"target":"https:https://example.com/search/key/{search_term_string}",
Remove the double https:
Also in case of JSON-LD: you cannot map name value to /{search_term_string}
A correct way is always like this:-
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "[website url]",
"potentialAction": {
"@type": "SearchAction",
"target": "[website search url]={search_term}",
"query-input": "required name=search_term"
}
}
</script>
Microdata:-
<div itemscope itemtype="http://schema.org/WebSite">
<meta itemprop="url" content="[website url]"/>
<form itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction">
<meta itemprop="target" content="[website search url]={search_term}"/>
<input itemprop="query-input" type="text" name="search_term">
<input type="submit">
</form>
</div>
Agree with above solution from @unor, now answering about you code correction
Please check the target url in posted JSON-LD:-
"target":"https:https://example.com/search/key/{search_term_string}",
Remove the double https:
Also in case of JSON-LD: you cannot map name value to /{search_term_string}
A correct way is always like this:-
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "[website url]",
"potentialAction": {
"@type": "SearchAction",
"target": "[website search url]={search_term}",
"query-input": "required name=search_term"
}
}
</script>
Microdata:-
<div itemscope itemtype="http://schema.org/WebSite">
<meta itemprop="url" content="[website url]"/>
<form itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction">
<meta itemprop="target" content="[website search url]={search_term}"/>
<input itemprop="query-input" type="text" name="search_term">
<input type="submit">
</form>
</div>
answered Jan 18 at 18:02
DeependerDeepender
215
215
How should i change this line?"target": "[website search url]={search_term}"
i got this error on google structured data testing toolINVALID_SYNTAX
.
– Natalie
Jan 18 at 19:12
@Natalie in that target you have to code for example test like this:-"target": "https://pinterest.com/search?q={test}",
"query-input": "required name=test"
– Deepender
Jan 19 at 9:51
add a comment |
How should i change this line?"target": "[website search url]={search_term}"
i got this error on google structured data testing toolINVALID_SYNTAX
.
– Natalie
Jan 18 at 19:12
@Natalie in that target you have to code for example test like this:-"target": "https://pinterest.com/search?q={test}",
"query-input": "required name=test"
– Deepender
Jan 19 at 9:51
How should i change this line?
"target": "[website search url]={search_term}"
i got this error on google structured data testing tool INVALID_SYNTAX
.– Natalie
Jan 18 at 19:12
How should i change this line?
"target": "[website search url]={search_term}"
i got this error on google structured data testing tool INVALID_SYNTAX
.– Natalie
Jan 18 at 19:12
@Natalie in that target you have to code for example test like this:-
"target": "https://pinterest.com/search?q={test}",
"query-input": "required name=test"
– Deepender
Jan 19 at 9:51
@Natalie in that target you have to code for example test like this:-
"target": "https://pinterest.com/search?q={test}",
"query-input": "required name=test"
– Deepender
Jan 19 at 9:51
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54248725%2fcan-i-use-a-friendly-url-on-searchaction%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown