I want to add some news links on my new site about Bitcoin, but I want the link to invoke a search for bitcoin directly. In particular, can I do that on my favorite news site, BBC News?
Nice to get a question from another fan of BBC News. I’ve been reading BBC News and listening to BBC World Service and watching BBC television productions since I was a wee tot. Great stuff, solid approach to journalism and coverage of the entire world, not just a single region or country. Well worth checking out at bbc.co.uk if you’ve never gone to the site before.
What you’re talking about is a bit more tricky than just linking to the site, of course. What we’re going to need to do – and it’s actually not too hard – is to reverse engineer the way that the search works on the site to be able to create search links, not just site links. No worries about it being too technical, however: We can do it!
So let’s jump in. Go to the BBC Web site and have a close look at the search box on the top:
Okay, it’s a navigational bar with a search box. Not actually too much to look at. 🙂
But let’s enter a search…
As you already know, the results are a list of articles that have the word bitcoin, as shown:
So far, there’s nothing notable here, right? I mean, you’ve done searches, you’ve seen the results.
What you need to check out is the URL of the search results page.
In this case it’s:
What this means is that you can replace ‘bitcoin’ in that URL with any search term and that’ll take you straight to the search results page on the site. Try it: https://www.bbc.co.uk/search?q=ethereum.
A click and you’re looking at the results of a search for ethereum. Cool, eh?
Armed with that little bit of URL information you can now not only make text links like Breaking Ethereum News by simply linking the words to the appropriate search URL, but you could even make buttons to do the same. One way is entirely within HTML with a mini-form:
<form action="https://www.bbc.co.uk/search" method="get"> <input type="hidden" name="q" value="ethereum"> <input type="submit" value="Ethereum News" /> </form>
The results are simple and the button works:
You can also create graphical buttons or even have a relevant image that jumps to a search result page from BBC too. For example, here’s an Ethereum image, click on it:
That’s it. You’re armed with enough info to be dangerous (well, relatively speaking). Now go forth and make some links!
Pro Tip: I have a lot of HTML and Web page coding tutorials. Please check ’em out!