Delete the text in the search bar

Hey, everybody.
I want to delete the text in this element, how to do it?
Dope theme

Would like to change via code injection.
Element code:
<input class="grow -my-5 py-5 -ml-3 pl-3 text-[1.65rem] focus-visible:outline-none placeholder:text-gray-400 outline-none truncate" placeholder="Search for posts, tags, and authors" value="">
image

Hello @Prome_Spex,

To delete the text in the search bar using code injection, you can use JavaScript to target the input element and set its value to an empty string. Here’s a snippet of JavaScript code that you can inject into your Ghost theme to achieve this.

document.addEventListener('DOMContentLoaded', function() {
    var searchInput = document.querySelector('input[placeholder="Search for posts, tags, and authors"]');
    if (searchInput) {
        searchInput.value = '';
    }
});

This code waits for the DOM to be fully loaded and then finds the input element with the specified placeholder. If the element is found, it sets its value to an empty string, effectively clearing any text it may contain. You can add this script to your Ghost theme’s code injection area in the admin panel.

Did you try it? Did it work?

@Prome_Spex , the reason the code above doesn’t work is because the search is actually a separate app in an iframe. For security reasons, you can’t easily change the contents of an iframe.

If you’re self hosting, you could fork sodo-search and make the desired changes and update config.json to load your forked version.

1 Like

Unfortunately the problem remained after the injection. I wonder if we’ll ever get to a no code website builder on ghost. :sweat_smile:

Ghost is a blogging platform. There are lots of no-code website builders out there, but Ghost isn’t one. You can absolutely make and edit non-blog pages in Ghost, but if you want/need the full drag-and-drop, never touch the CSS experience, you might be on the wrong platform.

(Having said that, I totally agree with you that this string in sodo-search should be customizable! :slight_smile: )

Made the changes, thanks to your advice, but it’s a lot of work to change one part. I think the easier it will be to create blogs the more people will come and the more options for monetization.

Ghost core is very good and fast, as well as convenient design, but the devil lies in the details. And the price for costamization of the site is too much on outsos.

It would be cool to connect the blog with the same webflow or framer.