diff --git a/internal/generator/html.go b/internal/generator/html.go index c2b6f53..f32002d 100644 --- a/internal/generator/html.go +++ b/internal/generator/html.go @@ -6,7 +6,9 @@ import ( "encoding/json" "fmt" "html/template" + "os" "path/filepath" + "strings" "sync" "time" @@ -31,6 +33,27 @@ func getTemplateFuncs() template.FuncMap { "shortenPubkey": func(pubkey string) string { return nostr.ShortenPubkey(pubkey) }, + "icon": func(name string) template.HTML { + // Read icon file from static/icons directory + iconPath := filepath.Join("static", "icons", name+".svg") + data, err := os.ReadFile(iconPath) + if err != nil { + // Return empty if icon not found + return template.HTML("") + } + + // Remove XML declaration if present + svg := strings.TrimSpace(string(data)) + if strings.HasPrefix(svg, " tag + svgStart := strings.Index(svg, " 0 { + svg = svg[svgStart:] + } + } + + return template.HTML(svg) + }, "dict": func(values ...interface{}) (map[string]interface{}, error) { if len(values)%2 != 0 { return nil, fmt.Errorf("dict requires an even number of arguments") diff --git a/package-lock.json b/package-lock.json index c5100b8..917ecce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,6 +6,9 @@ "": { "dependencies": { "@asciidoctor/core": "^3.0.4" + }, + "devDependencies": { + "lucide": "^0.564.0" } }, "node_modules/@asciidoctor/core": { @@ -93,6 +96,13 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "license": "ISC" }, + "node_modules/lucide": { + "version": "0.564.0", + "resolved": "https://registry.npmjs.org/lucide/-/lucide-0.564.0.tgz", + "integrity": "sha512-FasyXKHWon773WIl3HeCQpd5xS6E0aLjqxiQStlHNKktni+HDncc1sqY+6vRUbCfmDsIaKQz43EEQLAUDLZO0g==", + "dev": true, + "license": "ISC" + }, "node_modules/minimatch": { "version": "5.1.6", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", diff --git a/package.json b/package.json index 3bf13fb..c6633fe 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,8 @@ { "dependencies": { "@asciidoctor/core": "^3.0.4" + }, + "devDependencies": { + "lucide": "^0.564.0" } } diff --git a/static/icons/alert-circle.svg b/static/icons/alert-circle.svg new file mode 100644 index 0000000..2cfce34 --- /dev/null +++ b/static/icons/alert-circle.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/static/icons/alert-triangle.svg b/static/icons/alert-triangle.svg new file mode 100644 index 0000000..8e2ad22 --- /dev/null +++ b/static/icons/alert-triangle.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/static/icons/arrow-right.svg b/static/icons/arrow-right.svg new file mode 100644 index 0000000..1e428c4 --- /dev/null +++ b/static/icons/arrow-right.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/static/icons/book-open.svg b/static/icons/book-open.svg new file mode 100644 index 0000000..389f44e --- /dev/null +++ b/static/icons/book-open.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/static/icons/book-x.svg b/static/icons/book-x.svg new file mode 100644 index 0000000..3d7e6e0 --- /dev/null +++ b/static/icons/book-x.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/static/icons/book.svg b/static/icons/book.svg new file mode 100644 index 0000000..ab1b6e6 --- /dev/null +++ b/static/icons/book.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/static/icons/check-circle.svg b/static/icons/check-circle.svg new file mode 100644 index 0000000..380e7bb --- /dev/null +++ b/static/icons/check-circle.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/static/icons/clock.svg b/static/icons/clock.svg new file mode 100644 index 0000000..896a353 --- /dev/null +++ b/static/icons/clock.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/static/icons/copyright.svg b/static/icons/copyright.svg new file mode 100644 index 0000000..36d6723 --- /dev/null +++ b/static/icons/copyright.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/static/icons/external-link.svg b/static/icons/external-link.svg new file mode 100644 index 0000000..5948c10 --- /dev/null +++ b/static/icons/external-link.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/static/icons/file-text.svg b/static/icons/file-text.svg new file mode 100644 index 0000000..2bf2226 --- /dev/null +++ b/static/icons/file-text.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/static/icons/file-x.svg b/static/icons/file-x.svg new file mode 100644 index 0000000..6f62ad2 --- /dev/null +++ b/static/icons/file-x.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/static/icons/github.svg b/static/icons/github.svg new file mode 100644 index 0000000..ef4060c --- /dev/null +++ b/static/icons/github.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/static/icons/globe.svg b/static/icons/globe.svg new file mode 100644 index 0000000..c5e8e08 --- /dev/null +++ b/static/icons/globe.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/static/icons/hash.svg b/static/icons/hash.svg new file mode 100644 index 0000000..2e826e6 --- /dev/null +++ b/static/icons/hash.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/static/icons/home.svg b/static/icons/home.svg new file mode 100644 index 0000000..e7eff55 --- /dev/null +++ b/static/icons/home.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/static/icons/inbox.svg b/static/icons/inbox.svg new file mode 100644 index 0000000..a877b35 --- /dev/null +++ b/static/icons/inbox.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/static/icons/info.svg b/static/icons/info.svg new file mode 100644 index 0000000..e0332ca --- /dev/null +++ b/static/icons/info.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/static/icons/list.svg b/static/icons/list.svg new file mode 100644 index 0000000..a30c408 --- /dev/null +++ b/static/icons/list.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/static/icons/loader-2.svg b/static/icons/loader-2.svg new file mode 100644 index 0000000..44eae21 --- /dev/null +++ b/static/icons/loader-2.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/static/icons/mail.svg b/static/icons/mail.svg new file mode 100644 index 0000000..366e140 --- /dev/null +++ b/static/icons/mail.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/static/icons/package.svg b/static/icons/package.svg new file mode 100644 index 0000000..e0341e0 --- /dev/null +++ b/static/icons/package.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/static/icons/rss.svg b/static/icons/rss.svg new file mode 100644 index 0000000..83e2a33 --- /dev/null +++ b/static/icons/rss.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/static/icons/send.svg b/static/icons/send.svg new file mode 100644 index 0000000..d241ba5 --- /dev/null +++ b/static/icons/send.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/static/icons/user.svg b/static/icons/user.svg new file mode 100644 index 0000000..ed9793c --- /dev/null +++ b/static/icons/user.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/static/icons/x.svg b/static/icons/x.svg new file mode 100644 index 0000000..96a1d1f --- /dev/null +++ b/static/icons/x.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/templates/404.html b/templates/404.html index 2433678..d80220f 100644 --- a/templates/404.html +++ b/templates/404.html @@ -1,8 +1,8 @@ {{define "content"}}
-

404

+

{{icon "alert-circle"}} 404

The page you're looking for doesn't exist.

- Go Home + {{icon "home"}} Go Home
{{end}} diff --git a/templates/500.html b/templates/500.html index 6685793..6426307 100644 --- a/templates/500.html +++ b/templates/500.html @@ -1,8 +1,8 @@ {{define "content"}}
-

500

+

{{icon "alert-triangle"}} 500

Something went wrong on our end. Please try again later.

- Go Home + {{icon "home"}} Go Home
{{end}} diff --git a/templates/base.html b/templates/base.html index 3323f6d..8673bf3 100644 --- a/templates/base.html +++ b/templates/base.html @@ -26,7 +26,6 @@ - {{if .StructuredData}}{{end}} @@ -48,18 +47,18 @@ @@ -82,60 +81,11 @@ diff --git a/templates/blog.html b/templates/blog.html index 0a60a86..5575687 100644 --- a/templates/blog.html +++ b/templates/blog.html @@ -29,10 +29,10 @@ {{range $index, $item := .BlogItems}}
  • -
    {{$item.Title}}
    +
    {{icon "file-text"}} {{$item.Title}}
    {{if $item.Time}}
    - + {{if $item.Author}} {{end}} @@ -61,10 +61,10 @@ {{else}}
    -

    No Articles

    +

    {{icon "file-x"}} No Articles

    -

    No blog articles available yet.

    +

    {{icon "inbox"}} No blog articles available yet.

    {{end}} diff --git a/templates/components.html b/templates/components.html index a1d59cc..b96bb10 100644 --- a/templates/components.html +++ b/templates/components.html @@ -1,21 +1,21 @@ {{/* Feed Component - Reusable feed sidebar */}} {{define "feed"}}
    -

    Recent Notes View Full Feed

    +

    {{icon "rss"}} Recent Notes {{icon "external-link"}} View Full Feed

    {{range .FeedItems}} {{else}} -

    No recent notes available.

    +

    {{icon "inbox"}} No recent notes available.

    {{end}}
    @@ -24,14 +24,14 @@ {{/* Alert Component - Success message */}} {{define "alert-success"}} {{end}} {{/* Alert Component - Error message */}} {{define "alert-error"}} {{end}} @@ -39,11 +39,11 @@ {{define "wiki-sidebar"}}
    @@ -56,9 +56,9 @@ {{if .Success}} {{end}} @@ -95,8 +95,8 @@
    - - + +
    @@ -156,10 +156,7 @@ // Disable submit button submitBtn.disabled = true; - submitBtn.innerHTML = ' Signing...'; - if (typeof lucide !== 'undefined') { - lucide.createIcons(); - } + submitBtn.innerHTML = ' Signing...'; hideStatus(); try { @@ -212,10 +209,7 @@ }; // Sign the event - submitBtn.innerHTML = ' Publishing...'; - if (typeof lucide !== 'undefined') { - lucide.createIcons(); - } + submitBtn.innerHTML = ' Publishing...'; const signedEvent = await window.nostr.signEvent(unsignedEvent); // Send to API @@ -235,19 +229,13 @@ } else { showStatus('Failed to publish issue: ' + (result.error || 'Unknown error'), true); submitBtn.disabled = false; - submitBtn.innerHTML = ' Submit'; - if (typeof lucide !== 'undefined') { - lucide.createIcons(); - } + submitBtn.innerHTML = ' Submit'; } } catch (error) { console.error('Error:', error); showStatus('Error: ' + error.message, true); submitBtn.disabled = false; - submitBtn.innerHTML = ' Submit'; - if (typeof lucide !== 'undefined') { - lucide.createIcons(); - } + submitBtn.innerHTML = ' Submit'; } }); })(); diff --git a/templates/ebooks.html b/templates/ebooks.html index a49fe63..2258231 100644 --- a/templates/ebooks.html +++ b/templates/ebooks.html @@ -29,12 +29,12 @@ - View + {{icon "external-link"}} View {{else}} - No e-books found. + {{icon "book-x"}} No e-books found. {{end}} diff --git a/templates/landing.html b/templates/landing.html index 42077e4..b048d64 100644 --- a/templates/landing.html +++ b/templates/landing.html @@ -9,19 +9,19 @@

    Explore Our Content

    -

    Wiki

    +

    {{icon "book-open"}} Wiki

    Browse our comprehensive wiki documentation.

    -

    Blog

    +

    {{icon "file-text"}} Blog

    Read the latest articles and updates.

    - View Blog + {{icon "arrow-right"}} View Blog
    diff --git a/templates/page.html b/templates/page.html index 0a487c3..e4a6bbf 100644 --- a/templates/page.html +++ b/templates/page.html @@ -2,14 +2,14 @@
    @@ -19,7 +19,7 @@ {{if .TableOfContents}} {{end}} diff --git a/templates/wiki.html b/templates/wiki.html index 51c20df..d1ba5fd 100644 --- a/templates/wiki.html +++ b/templates/wiki.html @@ -1,15 +1,15 @@ {{define "content"}}
    {{if .WikiPages}} -

    Select an article from the sidebar to get started.

    +

    {{icon "arrow-right"}} Select an article from the sidebar to get started.

    {{else}} -

    No wiki articles available yet.

    +

    {{icon "inbox"}} No wiki articles available yet.

    {{end}}