Added a basic search page and edited README
This commit is contained in:
		
							parent
							
								
									421635612c
								
							
						
					
					
						commit
						36b3cb7b8d
					
				
							
								
								
									
										26
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								README.md
									
									
									
									
									
								
							| @ -1,12 +1,6 @@ | ||||
| [](https://app.netlify.com/sites/digital-garden-jekyll-template/deploys) | ||||
| # Digital garden Jekyll template + Searching | ||||
| 
 | ||||
| # Digital garden Jekyll template | ||||
| 
 | ||||
| Use this template repository to get started with your own digital garden. | ||||
| 
 | ||||
| **I wrote a tutorial explaining how to set it up: [Setting up your own digital garden with Jekyll](https://maximevaillancourt.com/blog/setting-up-your-own-digital-garden-with-jekyll)** | ||||
| 
 | ||||
| Preview the template here: https://digital-garden-jekyll-template.netlify.app/ | ||||
| A template based off of [this template](https://github.com/maximevaillancourt/digital-garden-jekyll-template), incorporating a Jekyll search plugin from [here](https://github.com/christian-fei/Simple-Jekyll-Search). | ||||
| 
 | ||||
| - Based on Jekyll, a static website generator | ||||
| - Supports Roam-style double bracket link syntax to other notes | ||||
| @ -15,21 +9,7 @@ Preview the template here: https://digital-garden-jekyll-template.netlify.app/ | ||||
| - Includes graph visualization of the notes and their links | ||||
| - Features a simple and responsive design | ||||
| - Supports Markdown or HTML notes | ||||
| - *NEW:* Supports searching of existing posts. | ||||
| 
 | ||||
| <img width="1522" alt="Screen Shot 2020-05-19 at 23 05 46" src="https://user-images.githubusercontent.com/8457808/82400515-7d026d80-9a25-11ea-83f1-3b9cb8347e07.png"> | ||||
| 
 | ||||
| ## A note about GitHub Pages | ||||
| 
 | ||||
| **Update (January 2023)**: it seems that GitHub Pages supports custom plugins now, thanks to GitHub Actions ([view relevant discussion](https://github.com/maximevaillancourt/digital-garden-jekyll-template/discussions/144)). | ||||
| 
 | ||||
| GitHub Pages only partially supports this template: to power the interactive notes graph, this template uses a custom Jekyll plugin to generate the graph data in [`notes_graph.json`](https://github.com/maximevaillancourt/digital-garden-jekyll-template/blob/7ac331a4113bac77c993856562acc2bfbde9f2f7/_plugins/bidirectional_links_generator.rb#L102), and [GitHub Pages doesn't support custom Jekyll plugins](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll#plugins). | ||||
| 
 | ||||
| If you want to use the graph with GitHub Pages, you may try building your garden locally using Jekyll then pushing the result to GitHub Pages. | ||||
| 
 | ||||
| Alternatively, you may deploy your garden to Netlify and it'll work out of the box. [I wrote a guide explaining how to set this up](https://maximevaillancourt.com/blog/setting-up-your-own-digital-garden-with-jekyll). | ||||
| 
 | ||||
| If you don't care about the graph, you can simply remove it from this layout, [as explained here](https://github.com/maximevaillancourt/digital-garden-jekyll-template/discussions/132#discussioncomment-3625772). | ||||
| 
 | ||||
| ## License | ||||
| 
 | ||||
| Source code is available under the [MIT license](LICENSE.md). | ||||
|  | ||||
							
								
								
									
										22
									
								
								_pages/search.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								_pages/search.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | ||||
| --- | ||||
| layout: page | ||||
| title: Search | ||||
| permalink: /search | ||||
| --- | ||||
| 
 | ||||
| <input type="text" id="search-input" placeholder="Search blog posts.."> | ||||
| 
 | ||||
| <ul id="results-container"></ul> | ||||
| 
 | ||||
| <script src="https://unpkg.com/simple-jekyll-search@latest/dest/simple-jekyll-search.min.js"></script> | ||||
| 
 | ||||
| <script> | ||||
|     window.simpleJekyllSearch = new SimpleJekyllSearch({ | ||||
|         searchInput: document.getElementById('search-input'), | ||||
|         resultsContainer: document.getElementById('results-container'), | ||||
|         json:'{{ site.baseurl }}/search.json', | ||||
|         searchResultTemplate: '<li><a href="{url}?query={query}" title="{desc}">{title}</a></li>', | ||||
|         noResultsText: 'No results found', | ||||
|         limit: 10 | ||||
|     }); | ||||
| </script> | ||||
							
								
								
									
										15
									
								
								search.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								search.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | ||||
| --- | ||||
| layout: none | ||||
| --- | ||||
| [ | ||||
|   {% for post in site.notes %} | ||||
|     { | ||||
|       "title"    : "{{ post.title | escape }}", | ||||
|       "category" : "{{ post.category }}", | ||||
|       "tags"     : "{{ post.tags | join: ', ' }}", | ||||
|       "url"      : "{{ site.baseurl }}{{ post.url }}", | ||||
|       "date"     : "{{ post.date }}", | ||||
|       "content"  : "{{ post.content | strip_html | strip_newlines | smartify }}" | ||||
|     } {% unless forloop.last %},{% endunless %} | ||||
|   {% endfor %} | ||||
| ] | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 walcutt
						walcutt