Welcome to TalkGraphics.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,826

    Lightbulb Generic Search Website Button

    This Placeholder Body code comes in two parts:
    1. The Search Form HTML.
      1. This is generated from https://ddg.patdryburgh.com
        1. In other words, you can do this yourself.

      2. It creates a Search button that you can customise to your specific site colours.
      3. It uses DuckDuckGo and your inputted site URL, or Top Level Domain (TLD).
      4. You can stop at this point.

    2. A JavaScript enhancement.
      1. Basically, this replaces the inputted TLD with the one whose page it finds itself on.


    The Code:
    Code:
    <form method="get" id="ddgSearch" action="https://duckduckgo.com/">
        <input type="hidden" name="sites" value=""/>
        <input type="hidden" name="k7" value="#e0dada"/>
        <input type="hidden" name="k8" value="#222222"/>
        <input type="hidden" name="k9" value="#00278e"/>
        <input type="hidden" name="kx" value="#20692b"/>
        <input type="hidden" name="kj" value="#f8e71c"/>
        <input type="hidden" name="kt" value="o"/>
        <input type="text" name="q" placeholder="Search…" aria-label=""/>
        <button type="submit">Search</button>
    </form>
    
    
    <script>
      var TLD = window.location.protocol + "//" + window.location.host + "/";
      oFormObject = document.forms['ddgSearch'];
    
    
      oFormObject.elements['sites'].value = TLD;
      oFormObject.elements['q'].setAttribute('aria-label', 'Search ' + TLD);
    </script>
    This code replaces your sites.value and aria-label with the TLD detail.

    Say, you were happy with my choice of house colours then you would just add this code to a Placeholder and the job is done.
    You could tweak the colours manually or match with your current values of Palette from Image:
    • k7 - Background Colour.
    • k8 - Link Colour.
    • k9 - URL Colour.
    • kx - Text Colour.
    • kj - Header Colour.

    If you do not want a Search Button showing, change the code to <button type="submit" style="visibility: hidden">Search</button>

    Why?
    Say, you add SSH and access your website through SSL, https://, then you don't need to do a thing.
    Do remember all web search engines need to have crawled your site at some point so this works best for an enhancement to an existing site.
    It uses DuckDuckGo as it does not track your end-user, which is only fair.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  2. #2
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,504

    Default Re: Generic Search Website Button

    Most sites can use a search function.

    It would be really helpful (and a tremendous drain on time) to start a sticky thread of all the solutions you and others have added). It would be such a useful reference.

  3. #3
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,826

    Default Re: Generic Search Website Button

    Quote Originally Posted by gwpriester View Post
    Most sites can use a search function.
    It would be really helpful (and a tremendous drain on time) to start a sticky thread of all the solutions you and others have added). It would be such a useful reference.
    Thank you Gary.

    The "stickie thread" is already in place; https://www.talkgraphics.com/tags.php?tag=nugget.

    I have been reviewing a lot of my contributions and have also included ones that I think others have nailed too.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  4. #4
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,504

    Default Re: Generic Search Website Button

    Excellent.

  5. #5
    Join Date
    Mar 2009
    Posts
    4,503

    Default Re: Generic Search Website Button

    Quote Originally Posted by Acorn View Post

    The "stickie thread" is already in place; https://www.talkgraphics.com/tags.php?tag=nugget.

    I have been reviewing a lot of my contributions and have also included ones that I think others have nailed too.
    Thanks for this listing, Acorn! Very useful.

 

 

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •