Opened hack code blocks by default if only a few lines.
Added recent hacks to footer of back pages to fill them a bit.
Updated sidebar with alternate hacking links.
Set design for main hacks list.
--- /dev/null
+---
+title: "BookStack Hacks"
+url: "/hacks"
+---
+Hacks for BookStack
\ No newline at end of file
--- /dev/null
+{{ partial "header.html" . }}
+
+{{ $baseurl := .Site.BaseURL }}
+
+<div class="shaded primary">
+ <div class="container hero padded-vertical">
+ <div class="row">
+ <div class="col-sm-8 col-sm-offset-2">
+ <h1 class="text-left">{{.Title}}</h1>
+ </div>
+ </div>
+ </div>
+</div>
+
+<div class="container">
+
+ <div class="row">
+
+ <div class="col-sm-8 col-sm-offset-2">
+
+ <p class="margins-vertical large">
+ This part of the site lists available "hacks" that can be applied to customize
+ BookStack or extend its functionality.
+ These hacks are not official supported and can cause instability, introduce issues and may conflict with future updates. Apply at your own risk!
+ </p>
+
+ <div class="margins-vertical large text-left">
+ <a href="/hacks/applying/" target="_blank">Applying Hacks</a>
+ <span class="inline block margins-horizontal muted">|</span>
+ <a href="https://github.com/BookStackApp/hacks" target="_blank">Hacks Source Repo</a>
+ </div>
+
+ {{ $paginator := .Paginate (where .Pages "Params.Author" "!=" nil) }}
+
+ <div class="hack-box-list">
+ {{ range $paginator.Pages }}
+ {{ partial "list-hack" .}}
+ {{ end }}
+ </div>
+
+
+ {{ partial "pagination" $paginator }}
+
+ </div>
+
+ </div>
+</div>
+
+{{ partial "footer.html" . }}
\ No newline at end of file
<li><a href="/hacks/applying/">Applying Hacks</a></li>
<li><a href="https://github.com/BookStackApp/hacks">Hacks Source Repo</a></li>
</ul>
- <div>
- <h4>Latest Hacks</h4>
- </div>
- <ul>
+ </div>
+ <div>
+ <h4>Other Hacking</h4>
<ul>
- {{ range first 8 ( where .Site.RegularPages "Section" "hacks") }}
- {{ if .Params.Date }}
- <li><a href="{{.Permalink}}">{{ .Title }}</a></li>
- {{ end }}
- {{ end }}
+ <li><a href="/docs/admin/hacking-bookstack/">All Hacking Methods</a></li>
+ <li><a href="https://github.com/BookStackApp/api-scripts">Example API Scripts</a></li>
</ul>
</div>
<div class="sidebar-inner mobile">
<h1>{{.Title}}</h1>
- {{ if .Params.Date }}
+ {{ if .Params.Tested }}
<ul class="hack-meta">
{{ $author := .Params.Author }}
<li><strong>Author:</strong> <a href="https://github.com/{{ strings.TrimLeft "@" $author }}" target="_blank">{{ $author }}</a></li>
{{.Content}}
+
+ {{ if .Params.Tested }}
+ <hr>
+
+ <h4>Latest Hacks</h4>
+
+ <div class="hack-box-list">
+ {{ range first 5 ( where .Site.RegularPages "Section" "hacks") }}
+ {{ if .Params.Date }}
+ {{ partial "list-hack" .}}
+ {{ end }}
+ {{ end }}
+ </div>
+ {{ end }}
+
</main>
</div>
--- /dev/null
+{{ $baseurl := .Site.BaseURL }}
+<a href="{{ .RelPermalink }}" class="hack-box {{ .Section }}">
+ <div class="hack-header">
+ <h2 class="hack-title">{{ .Title }}</h2>
+ </div>
+ <section class="hack-excerpt">
+ <p>{{ .Summary }} <span class="read-more">»</span></p>
+ </section>
+ <div class="hack-meta">
+ Last Tested On {{ .Params.tested }}
+ </div>
+</a>
{{ end }}
{{ $type := .Get "type" }}
{{ $md := printf "```%s\n%s\n```" $ext (readFile $file) }}
+{{ $mdLen := len (split $md "\n") }}
<div class="hack-file-wrapper">
- <details>
+ <details {{if lt $mdLen 15}}open{{end}}>
<summary class="hack-file-block">
<div class="hack-file-block-filename">{{ $filename }}</div>
svg {
width: 1.6em;
}
+}
+
+.hack-box-list {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ gap: 1rem;
+}
+
+.hack-box {
+ background-color: #FFF;
+ border: 1.5px solid #e2e2e2;
+ box-shadow: 0 1px 3px 0 rgba(0,0,0,.1);
+ border-radius: 4px;
+ text-decoration: none;
+ display: flex;
+ flex-direction: column;
+ color: #222;
+ margin-bottom: 1rem;
+ min-width: 180px;
+ flex-basis: 320px;
+ flex-grow: 1;
+ h2 {
+ font-size: 1.4rem;
+ font-weight: bold;
+ padding: 0 1rem;
+ }
+ .hack-excerpt {
+ display: -webkit-box;
+ padding: 0 1rem;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+ margin-bottom: .5rem;
+ p {
+ margin-bottom: 0;
+ }
+ }
+ .hack-meta {
+ padding: 0 1rem;
+ font-size: .9rem;
+ color: #444;
+ margin-top: auto;
+ }
+ &:hover {
+ text-decoration: none;
+ box-shadow: 0 2px 8px 0 rgba(0,0,0,.15);
+ color: #000;
+ h2 {
+ color: $primary;
+ text-decoration: underline;
+ }
+ }
}
\ No newline at end of file