techno-tim / littlelink-server

A lightweight, open source, stateless, and self-hosted alternative to linktree in a Docker container!
https://links.technotim.live
MIT License
901 stars 164 forks source link

Generic Links #5

Closed timothystewart6 closed 2 years ago

timothystewart6 commented 3 years ago

support for generic text based buttons

timothystewart6 commented 3 years ago

The easiest way is to add an option for ~3 buttons (like email) that render if an env is passed in.

Ashley-Buckingham commented 3 years ago

ah didn't see this, I have raised a PR for the short-term email text issue

Choubakawa commented 3 years ago

An idea:

Having 2 envs LINKS_HREF and LINKS_TEXT with splittable string.

if (env.LINKS_HREF && env.LINKS_TEXT) {
    var hrefs = LINKS_HREF.split(',');
    var texts = LINKS_TEXT.split(',');
    if (hrefs.length == texts.length) {
        for (let index = 0; index < hrefs.length; index++) {
            //need a generic icon
            // create a new element that match:
            // <a class="button button-default" href="' + hrefs[index] + '" target="_blank" rel="noopener"><img class="icon" src="icons/generic_link.svg" alt="Generic Icon">' + texts[index] + '</a><br>;
            //need to have an empty div with id 'generics' in the template
            document.getElementById('generics').appendChild(button);
        }
    }
}

Unlimited links for unlimited power lol

kenjibailly commented 2 years ago

Would love this to be added, so I can add all my website links. The only thing I'm missing! :D

timothystewart6 commented 2 years ago

Soon! Just need 30 min to crank it out :) Maybe tonight!

timothystewart6 commented 2 years ago

@Choubakawa @kenjibailly @Cur50r https://github.com/techno-tim/littlelink-server/pull/61 Should be available now!