├── README.md ├── blocks.min.css ├── index.html ├── script.js ├── socialite.png ├── style.css └── torus.min.js /README.md: -------------------------------------------------------------------------------- 1 | # Socialite 🍸 2 | 3 | Socialite is a tool I made to generate HTML tags for social sharing card metadata (like the ones you see on Twitter and Facebook cards) quickly. I build [a lot of side projects](https://thesephist.com/projects/) and one thing that gets very repetitive and tedious is copy-pasting all the social sharing metadata tags on every project. So to save time, I made this quick app. 4 | 5 | Now, I can just type in the relevant info, one-click and Ctrl-C to copy the tags, and paste it in my HTML. 6 | 7 | ![Screenshot of Socialite](socialite.png) 8 | 9 | Socialite was built entirely on [Replit](https://replit.com), using [Torus](https://github.com/thesephist/torus) and [blocks.css](https://thesephist.github.io/blocks.css/). 10 | 11 | [![Edit on Repl.it](https://repl-badge.jajoosam.repl.co/edit.png)](https://repl.it/@thesephist/socialite) -------------------------------------------------------------------------------- /blocks.min.css: -------------------------------------------------------------------------------- 1 | body{--block-text-color:#222;--block-background-color:#fff;--block-accent-color:#00ae86;--block-shadow-color:#444}.block{display:block;color:var(--block-text-color);border:3px solid var(--block-text-color);border-radius:3px;padding:4px 8px;background:var(--block-background-color);font-weight:700;cursor:pointer;box-sizing:border-box;position:relative;top:-2px;left:-2px;transition:transform .2s;margin:8px 6px 10px;z-index:1;user-select:none;-webkit-user-select:none;-moz-user-select:none}.block.wrapper,.block.wrapper.inline{display:inline-block;padding:0}.block.wrapper>*{margin:0}.block:before{content:"";background:var(--block-background-color);border:3px solid var(--block-text-color);border-radius:3px;box-sizing:border-box;position:absolute;top:-3px;left:-3px;height:calc(100% + 6px);width:calc(100% + 6px);z-index:-1}.block:focus,.block:hover{transform:translate(2px,2px)}.block:after{content:"";display:block;box-sizing:border-box;background:var(--block-shadow-color);border:3px solid var(--block-text-color);border-radius:3px;height:calc(100% + 6px);width:calc(100% + 6px);position:absolute;top:3px;left:3px;right:0;z-index:-2;transition:transform .2s}.block:focus:after,.block:hover:after{transform:translate(-2px,-3px)}.block:active{color:var(--block-text-color);transform:translate(3px,3px)}.block:active:after{transform:translate(-4px,-4px)}.block:focus{outline:none}.block.fixed{cursor:auto}.block.fixed:active,.block.fixed:active:after,.block.fixed:active:before,.block.fixed:focus,.block.fixed:focus:after,.block.fixed:focus:before,.block.fixed:hover,.block.fixed:hover:after,.block.fixed:hover:before{transform:none}.block.accent{color:var(--block-background-color)}.block.accent,.block.accent:before{background:var(--block-accent-color)}.block.inline{display:inline-block;font-size:.75em;padding:0 6px;margin:3px 2px 1px 4px}.block.inline:after{top:-1px;left:-1px}.block.inline:focus,.block.inline:hover{transform:translate(1px,1px)}.block.inline:focus:after,.block.inline:hover:after{transform:translate(-1px,-1px)}.block.inline:active{transform:translate(2px,2px)}.block.round,.block.round:after,.block.round:before{border-radius:30px}.block.round:after{left:1px} 2 | /*# sourceMappingURL=blocks.min.css.map */ -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Socialite 🍸 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /script.js: -------------------------------------------------------------------------------- 1 | const { 2 | Record, 3 | Component, 4 | } = window.Torus; 5 | const html = window.jdom; 6 | 7 | function makeSocialTags({ 8 | twitterUsername, 9 | url, 10 | title, 11 | description, 12 | imagePath, 13 | }) { 14 | // combine pieces of image URL and remove potential duplicate // in path 15 | const imageURL = url.trim() + ('/' + imagePath.trim()).replace(/^\/\//, '/'); 16 | 17 | return ` 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | `.split('\n').map(s => s.trim()).join('\n'); 29 | } 30 | 31 | class App extends Component { 32 | init(rec) { 33 | this._selectedByClick = false; 34 | 35 | this.bind(rec, data => this.render(data)); 36 | } 37 | handleInput(name, evt) { 38 | this.record.update({ [name]: evt.target.value }); 39 | } 40 | makeOnInput(name) { 41 | return this.handleInput.bind(this, name); 42 | } 43 | compose(data) { 44 | const makeInput = name => { 45 | return html`
46 | 53 |
54 | 57 |
58 |
`; 59 | } 60 | 61 | return html`
62 |
63 |

Socialite 🍸

64 |

65 | Socialite is a tool I made to generate HTML tags for social sharing 66 | card metadata (like the ones you see on Twitter and Facebook cards) quickly. 67 | Yes, the social images for this app are generated by Socialite! To validate 68 | that they work on your site, use the 69 | Open Graph Debugger 70 | and the 71 | Twitter Card Validator. 72 |

73 |
74 |
75 |
76 | ${[ 77 | 'twitterUsername', 78 | 'url', 79 | 'title', 80 | 'imagePath', 81 | 'description', 82 | ].map(name => makeInput(name))} 83 |
84 |
👇
85 |
86 | 87 |
88 |