How to avoid hash in search result URL?

When I search for anything on our website, it gets a #___gatsby suffix, for example:

https://versionpress.com/open-source/#___gatsby
https://versionpress.com/blog/2015/11/moved-to-github/#___gatsby

If the search result leads to a specific section of the site, then the hash is useful, for example:

https://versionpress.com/blog/2015/11/moved-to-github/#why-to-move

But if it’s a “top-level” result, not within any section, the #___gatsby suffix is annoying. Is there a way to get rid of it? This is our crawler config:

{
    "index_name": "versionpress.com",
    "start_urls": [
        {
            "url": "https://versionpress.com/blog/",
            "selectors_key": "blog"
        },
        {
            "url": "https://versionpress.com/",
            "selectors_key": "website"
        }
    ],
    "selectors": {
        "website": {
            "lvl0": {
                "selector": "",
                "global": true,
                "default_value": "Website"
            },
            "lvl1": "h1",
            "lvl2": "h2",
            "lvl3": "h3",
            "lvl4": "h4",
            "text": "p, li"
        },
        "blog": {
            "lvl0": {
                "selector": "",
                "global": true,
                "default_value": "Blog"
            },
            "lvl1": ".block-post h1",
            "lvl2": ".block-post h2",
            "lvl3": ".block-post h3",
            "lvl4": ".block-post h4",
            "text": ".block-post p, li"
        }
    },
    "selectors_exclude": [
        ".card-wrapper",
        ".blog-header",
        ".blogposts-list",
        ".header > .navbar",
        "#footer"
    ]
}

:wave: @borekb,

I am a software enginner working on DocSearch :open_book:

It looks like you are using our tool on your own :hammer_and_wrench: .

This point comes from the way we build records. We extract the id or name attribute to have the proper anchor. :anchor:

Every elements matching your lvlX selectors must have a unique name or id set. :id: Please watch the following section explaining this point.

Once this is done, run a new crawl and the magic will happen, :swimming_man:

Have a great day,

Cheers

Hi @Sylvain.PACE, thanks for chiming in! So can the hash be avoided or not? I’d like to end up with this URL:

https://versionpress.com/open-source/

Not this:

https://versionpress.com/open-source/#some-hash

I would recommend you to use transformdata. This JS function will remove the anchor.

Cheers

Thanks, we’ll try it.