Google has been serving the search community much better of late. Whether it is about announcing the latest updates, posting useful documentation or answering questions asked to the members of the team, Google is really quick stating what works and what doesn’t work in searches. There are some SEO techniques that Google does not support officially but are still effective and useful, to some extent.
One of these for websites built using AJAX based dynamic content is the escaped fragment solution with which content can be made easily accessible to search engine bots. The method involves using a hashbang (#!) to specify the parameter that allows the search engine to rewrite the URL and request content from a static page. Google has announced the deprecation of this solution and no longer supports it but it is still effective and not killed off.
In this guide, we talk about how you can use hash bang URLs for SEO.
Hashbang SEO in 2019 – What You Should Know?
A hash URL is when you click on a link and it jumps to a particular section of the page. Using a link in the meta description is a great way to rank on the search engine. When writing content, it is not always possible to answer the user’s question in a way that they can find it instantly. Creating hash URLs and allowing Google to jump to the content of interest right from the meta description means they are more likely to stay on the page.
Google announced in 2015 that the AJAX crawling scheme is deprecated and no hashtags should be used in URLs as they are bad for the search. However, this was about the use of hashtags where it called new content to be loaded. Using them as basic web anchors to scroll to a particular section of the page that was already loaded at the first load is completely fine. If you program the site to load new content based on what comes after the hash sign in the URL, it is not supported. Google made clear in 2017 that Ajax pages using hashbang URLs will be rendered.
It has also provided a syntax for working with the fragments. The hash bang syntax suggests placing an exclamation mark next to the hash sign to tell Google that you used the fragments for loading separate variations of the content that you want to be crawled. With this approach, your pages with hash bang URLs will be crawled, seen and indexed by Google and will benefit your SEO.
A large number of sites use hashbang URLs as they have some useful features which make them great for client-side applications. Apart from providing addresses for application states, giving caching, enabling web applications to fetch data from other servers, hashbang URLs have SEO benefits as well. Use of hashbang URLs increases the rank of the page for the base URL. This is because in a search engine, more links would point to the base URL.
Remove Hashbang Angular
Removing these hashtags from the URL to get clean URLs is easy. It can be done by adding two things.
- Configuration of $locationProvider
- Setting the base path for relative links
The $location service is responsible for parsing the URL in the address bar and makes the URL available to the application. Any modifications made to the URL in the address bar affect the service and changes made to the $location affect the URL in the browser’s address bar. We can use the #locationProvider module and html5Mode to remove the hashbang. You can write
to configure the module and change the URL.
Next, we can set the base URL in the application by writing the <base> tag in the head section of the HTML. This ensures that the application loads correctly.
We hope you find this guide helpful. Do share your thoughts and experiences with us in the comments section below.