admin.html (2197 bytes)
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1"> 6 <title>Links admin</title> 7 <style> 8 body { font-family: sans-serif; max-width: 48rem; margin: 1rem auto; padding: 0 1rem; } 9 form { margin: 0.5rem 0; } 10 input[type=text], input[type=url] { width: 100%; box-sizing: border-box; margin: 0.2rem 0; } 11 li { margin: 0.4rem 0; } 12 .host, .tags { color: #666; font-size: 0.9em; } 13 .message { background: #ffd; padding: 0.5rem; } 14 li form { display: inline; } 15 li form.feed { display: block; margin: 0.2rem 0; } 16 form.feed input[type=url] { width: 70%; } 17 </style> 18 </head> 19 <body> 20 <h1>Links</h1> 21 <p><a href="links.txt">links.txt</a> · <a href="atom.xml">atom.xml</a> · <a href="/links.html">public page</a></p> 22 {{with .Message}}<p class="message">{{.}}</p>{{end}} 23 24 <h2>Add a link</h2> 25 <form method="post" action="admin/add"> 26 <input type="url" name="url" placeholder="https://example.com" required> 27 <input type="text" name="desc" placeholder="Description"> 28 <input type="text" name="tags" placeholder="Tags, with spaces between them"> 29 <input type="url" name="feed" placeholder="Feed (RSS or Atom) of the site, if it has one"> 30 <button>Add</button> 31 </form> 32 33 <h2>Import a file</h2> 34 <p>An sbm bookmark file, or the HTML that a browser exports. URLs that are links already are skipped. A line with a feed (the fourth field) gives its feed to a link that has none.</p> 35 <form method="post" action="admin/import" enctype="multipart/form-data"> 36 <input type="file" name="file" required> 37 <button>Import</button> 38 </form> 39 40 <h2>{{len .Links}} links, newest first</h2> 41 <ul> 42 {{range .Links}}<li>{{if .Href}}<a href="{{.Href}}">{{.Title}}</a>{{else}}{{.Title}}{{end}} 43 <span class="host">{{.Address}}</span> 44 {{with .Tags}}<span class="tags">{{range .}}{{.}} {{end}}</span>{{end}} 45 <form method="post" action="admin/delete"><input type="hidden" name="url" value="{{.URL}}"><button>Delete</button></form> 46 <form class="feed" method="post" action="admin/feed"><input type="hidden" name="url" value="{{.URL}}"><input type="url" name="feed" value="{{.Feed}}" placeholder="Feed (RSS or Atom)"> <button>Save feed</button></form></li> 47 {{end}}</ul> 48 </body> 49 </html>