[Theme] (Change) migrate content to theme stack
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-brand-facebook"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 10v4h3v7h4v-7h3l1 -4h-4v-2a1 1 0 0 1 1 -1h3v-4h-3a5 5 0 0 0 -5 5v2h-3" /></svg>
|
||||
|
After Width: | Height: | Size: 406 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-brand-github"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 19c-4.3 1.4 -4.3 -2.5 -6 -3m12 5v-3.5c0 -1 .1 -1.4 -.5 -2c2.8 -.3 5.5 -1.4 5.5 -6a4.6 4.6 0 0 0 -1.3 -3.2a4.2 4.2 0 0 0 -.1 -3.2s-1.1 -.3 -3.5 1.3a12.3 12.3 0 0 0 -6.2 0c-2.4 -1.6 -3.5 -1.3 -3.5 -1.3a4.2 4.2 0 0 0 -.1 3.2a4.6 4.6 0 0 0 -1.3 3.2c0 4.6 2.7 5.7 5.5 6c-.6 .6 -.6 1.2 -.5 2v3.5" /></svg>
|
||||
|
After Width: | Height: | Size: 624 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-brand-gitlab"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M21 14l-9 7l-9 -7l3 -11l3 7h6l3 -7z" /></svg>
|
||||
|
After Width: | Height: | Size: 367 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-brand-linkedin"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M8 11v5" /><path d="M8 8v.01" /><path d="M12 16v-5" /><path d="M16 16v-3a2 2 0 1 0 -4 0" /><path d="M3 7a4 4 0 0 1 4 -4h10a4 4 0 0 1 4 4v10a4 4 0 0 1 -4 4h-10a4 4 0 0 1 -4 -4z" /></svg>
|
||||
|
After Width: | Height: | Size: 509 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-brand-twitter"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M22 4.01c-1 .49 -1.98 .689 -3 .99c-1.121 -1.265 -2.783 -1.335 -4.38 -.737s-2.643 2.06 -2.62 3.737v1c-3.245 .083 -6.135 -1.395 -8 -4c0 0 -4.182 7.433 4 11c-1.872 1.247 -3.739 2.088 -6 2c3.308 1.803 6.913 2.423 10.034 1.517c3.58 -1.04 6.522 -3.723 7.651 -7.742a13.84 13.84 0 0 0 .497 -3.753c0 -.249 1.51 -2.772 1.818 -4.013z" /></svg>
|
||||
|
After Width: | Height: | Size: 655 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-brand-youtube"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M2 8a4 4 0 0 1 4 -4h12a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-12a4 4 0 0 1 -4 -4v-8z" /><path d="M10 9l5 3l-5 3z" /></svg>
|
||||
|
After Width: | Height: | Size: 438 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-list"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 6l11 0" /><path d="M9 12l11 0" /><path d="M9 18l11 0" /><path d="M5 6l0 .01" /><path d="M5 12l0 .01" /><path d="M5 18l0 .01" /></svg>
|
||||
|
After Width: | Height: | Size: 450 B |
|
Before Width: | Height: | Size: 635 KiB After Width: | Height: | Size: 635 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"*": [
|
||||
"..\\themes\\hugo-theme-stack\\assets\\*"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
baseURL: /
|
||||
title: miti99
|
||||
theme: hugo-coder
|
||||
languageCode: vi
|
||||
defaultContentLanguage: vi
|
||||
paginate: 20
|
||||
enableEmoji: true
|
||||
|
||||
services:
|
||||
googleAnalytics:
|
||||
id: G-JR36Q9NSNP
|
||||
|
||||
markup:
|
||||
highlight:
|
||||
noClasses: false
|
||||
style: monokai
|
||||
|
||||
params:
|
||||
author: miti99
|
||||
license: <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA-4.0</a>
|
||||
description: miti99's personal website
|
||||
keywords: blog,developer,personal
|
||||
info:
|
||||
- Senior Software Engineer
|
||||
- Java Game Server Developer
|
||||
- Magician
|
||||
avatarURL: images/avatar.jpg
|
||||
# gravatar: minhtienit99@gmail.com
|
||||
favicon_32: images/favicon.png
|
||||
dateFormat: January 2, 2006
|
||||
since: 2020
|
||||
commit: https://github.com/tiennm99/tiennm99.github.io/tree/
|
||||
rtl: false
|
||||
colorScheme: auto
|
||||
hideColorSchemeToggle: false
|
||||
maxSeeAlsoItems: 5
|
||||
customCSS: []
|
||||
customSCSS: []
|
||||
customJS: []
|
||||
customRemoteJS: []
|
||||
enableTwemoji: true
|
||||
social:
|
||||
- name: github
|
||||
icon: fa-brands fa-github fa-2x
|
||||
weight: 1
|
||||
url: "https://github.com/tiennm99"
|
||||
- name: gitlab
|
||||
icon: fa-brands fa-gitlab fa-2x
|
||||
weight: 2
|
||||
url: "https://gitlab.com/miti99"
|
||||
- name: facebook
|
||||
icon: fa-brands fa-facebook fa-2x
|
||||
weight: 3
|
||||
url: "https://facebook.com/miti99"
|
||||
- name: youtube
|
||||
icon: fa-brands fa-youtube fa-2x
|
||||
weight: 4
|
||||
url: "https://youtube.com/@miti99"
|
||||
- name: linkedin
|
||||
icon: fa-brands fa-linkedin fa-2x
|
||||
weight: 5
|
||||
url: "https://www.linkedin.com/in/miti99"
|
||||
- name: X
|
||||
icon: fa-brands fa-x-twitter fa-2x
|
||||
weight: 6
|
||||
url: "https://twitter.com/tienthieusac"
|
||||
- name: RSS
|
||||
icon: fa-solid fa-rss fa-2x
|
||||
weight: 7
|
||||
url: index.xml
|
||||
rel: alternate
|
||||
type: application/rss+xml
|
||||
giscus:
|
||||
repo: tiennm99/tiennm99.github.io
|
||||
repoID: R_kgDOILzXrw
|
||||
category: Announcements
|
||||
categoryID: DIC_kwDOILzXr84CeYAw
|
||||
mapping: pathname
|
||||
term:
|
||||
strict: 0
|
||||
reactionsEnabled: 1
|
||||
emitMetadata: 0
|
||||
inputPosition: top
|
||||
theme: dark
|
||||
lang:
|
||||
loading: lazy
|
||||
|
||||
taxonomies:
|
||||
category: categories
|
||||
series: series
|
||||
tag: tags
|
||||
author: authors
|
||||
|
||||
languages:
|
||||
vi:
|
||||
languageName: ":vi:"
|
||||
menu:
|
||||
main:
|
||||
- name: About
|
||||
weight: 1
|
||||
url: about/
|
||||
- name: Blog
|
||||
weight: 2
|
||||
url: posts/
|
||||
- name: Pages
|
||||
weight: 3
|
||||
url: pages/
|
||||
- name: Search
|
||||
weight: 4
|
||||
url: search/
|
||||
- name: Tags
|
||||
weight: 5
|
||||
url: tags/
|
||||
- name: Web CV
|
||||
url: https://tiennm99.github.io/webcv
|
||||
- name: PDF CV
|
||||
url: https://tiennm99.github.io/cv/miti99.pdf
|
||||
|
||||
outputs:
|
||||
home:
|
||||
- html
|
||||
- rss
|
||||
- json
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
menu:
|
||||
main:
|
||||
name: Home
|
||||
weight: -100
|
||||
params:
|
||||
icon: home
|
||||
---
|
||||
@@ -1,7 +1,17 @@
|
||||
---
|
||||
title: "Giới thiệu"
|
||||
title: Giới thiệu
|
||||
description: Về bản thân mình
|
||||
aliases:
|
||||
- about-me
|
||||
- contact
|
||||
menu:
|
||||
main:
|
||||
weight: -90
|
||||
params:
|
||||
icon: user
|
||||
---
|
||||
|
||||
|
||||
Xin chào, mừng bạn đã đến với trang của mình.
|
||||
|
||||
Mình tên Minh Tiến, sinh năm 1999 (vì vậy blog là miti99 :)))), sinh viên ngành Khoa học Máy tính khóa 2017 tại trường Đại học Bách Khoa Tp.HCM.
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: "Archives"
|
||||
date: 2019-05-28
|
||||
layout: "archives"
|
||||
slug: "archives"
|
||||
menu:
|
||||
main:
|
||||
weight: -70
|
||||
params:
|
||||
icon: archives
|
||||
---
|
||||
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title: Links
|
||||
links:
|
||||
- title: Web CV
|
||||
description: CV bản web, xem online
|
||||
website: https://tiennm99.github.io/webcv
|
||||
# image:
|
||||
- title: PDF CV
|
||||
description: CV dạng file, có thể download
|
||||
website: https://tiennm99.github.io/cv/miti99.pdf
|
||||
# image:
|
||||
menu:
|
||||
main:
|
||||
weight: -50
|
||||
params:
|
||||
icon: link
|
||||
|
||||
comments: false
|
||||
---
|
||||
@@ -1,5 +1,10 @@
|
||||
---
|
||||
title: "Pages"
|
||||
title: Pages
|
||||
description: Danh sách pages đã làm
|
||||
menu:
|
||||
main:
|
||||
params:
|
||||
icon: list
|
||||
---
|
||||
|
||||
Danh sách những trang mình host trên [GitHub Pages](https://pages.github.com/). Thường khá thú vị :>
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: "Search"
|
||||
slug: "search"
|
||||
layout: "search"
|
||||
outputs:
|
||||
- html
|
||||
- json
|
||||
menu:
|
||||
main:
|
||||
weight: -60
|
||||
params:
|
||||
icon: search
|
||||
---
|
||||
|
Before Width: | Height: | Size: 213 KiB After Width: | Height: | Size: 213 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 197 KiB After Width: | Height: | Size: 197 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@@ -1,9 +0,0 @@
|
||||
---
|
||||
title: Tìm kiếm
|
||||
sitemap:
|
||||
priority : 0.1
|
||||
---
|
||||
|
||||
<!-- Credit: https://gist.github.com/eddiewebb/735feb48f50f0ddd65ae5606a1cb41ae -->
|
||||
|
||||
{{< search >}}
|
||||
@@ -0,0 +1,207 @@
|
||||
baseURL: /
|
||||
languageCode: vi
|
||||
theme: hugo-theme-stack
|
||||
title: miti99
|
||||
copyright: miti99
|
||||
|
||||
# Theme i18n support
|
||||
# Available values: ar, bn, ca, de, el, en, es, fr, hu, id, it, ja, ko, nl, pt-br, th, uk, zh-cn, zh-hk, zh-tw
|
||||
DefaultContentLanguage: vi
|
||||
|
||||
# Set hasCJKLanguage to true if DefaultContentLanguage is in [zh-cn ja ko]
|
||||
# This will make .Summary and .WordCount behave correctly for CJK languages.
|
||||
hasCJKLanguage: false
|
||||
|
||||
languages:
|
||||
vi:
|
||||
languageName: Tiếng Việt
|
||||
title: miti99
|
||||
weight: 1
|
||||
params:
|
||||
sidebar:
|
||||
subtitle: Senior Software Engineer
|
||||
|
||||
services:
|
||||
# GA Tracking ID
|
||||
googleAnalytics:
|
||||
id: G-JR36Q9NSNP
|
||||
|
||||
pagination:
|
||||
pagerSize: 10
|
||||
|
||||
permalinks:
|
||||
post: /p/:slug/
|
||||
page: /:slug/
|
||||
|
||||
|
||||
params:
|
||||
mainSections:
|
||||
- post
|
||||
featuredImageField: image
|
||||
rssFullContent: true
|
||||
favicon: /favicon.png # e.g.: favicon placed in `static/favicon.ico` of your site folder, then set this field to `/favicon.ico` (`/` is necessary)
|
||||
|
||||
footer:
|
||||
since: 2020
|
||||
customText:
|
||||
|
||||
dateFormat:
|
||||
published: Jan 02, 2006
|
||||
lastUpdated: Jan 02, 2006 15:04 MST
|
||||
|
||||
sidebar:
|
||||
emoji: 🧑💻
|
||||
subtitle: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
avatar:
|
||||
enabled: true
|
||||
local: true
|
||||
src: img/avatar.jpg
|
||||
|
||||
article:
|
||||
math: false
|
||||
toc: true
|
||||
readingTime: true
|
||||
license:
|
||||
enabled: true
|
||||
default: Licensed under CC BY-NC-SA 4.0
|
||||
|
||||
comments:
|
||||
enabled: true
|
||||
provider: giscus
|
||||
|
||||
giscus:
|
||||
repo: tiennm99/tiennm99.github.io
|
||||
repoID: R_kgDOILzXrw
|
||||
category: Announcements
|
||||
categoryID: DIC_kwDOILzXr84CeYAw
|
||||
mapping: pathname
|
||||
lightTheme: light
|
||||
darkTheme: dark
|
||||
reactionsEnabled: 1
|
||||
emitMetadata: 0
|
||||
|
||||
widgets:
|
||||
homepage:
|
||||
- type: search
|
||||
- type: archives
|
||||
params:
|
||||
limit: 5
|
||||
- type: categories
|
||||
params:
|
||||
limit: 10
|
||||
- type: tag-cloud
|
||||
params:
|
||||
limit: 10
|
||||
page:
|
||||
- type: toc
|
||||
|
||||
opengraph:
|
||||
twitter:
|
||||
# Your Twitter username
|
||||
site: tienthieusac
|
||||
|
||||
# Available values: summary, summary_large_image
|
||||
card: summary_large_image
|
||||
|
||||
defaultImage:
|
||||
opengraph:
|
||||
enabled: false
|
||||
local: false
|
||||
src: img/logo.png
|
||||
|
||||
colorScheme:
|
||||
# Display toggle
|
||||
toggle: true
|
||||
|
||||
# Available values: auto, light, dark
|
||||
default: auto
|
||||
|
||||
imageProcessing:
|
||||
cover:
|
||||
enabled: true
|
||||
content:
|
||||
enabled: true
|
||||
|
||||
### Custom menu
|
||||
### See https://stack.jimmycai.com/config/menu
|
||||
### To remove about, archive and search page menu item, remove `menu` field from their FrontMatter
|
||||
menu:
|
||||
main: []
|
||||
|
||||
social:
|
||||
- identifier: facebook
|
||||
name: Facebook
|
||||
url: https://facebook.com/miti99
|
||||
params:
|
||||
icon: brand-facebook
|
||||
|
||||
- identifier: github
|
||||
name: GitHub
|
||||
url: https://github.com/tiennm99
|
||||
params:
|
||||
icon: brand-github
|
||||
|
||||
- identifier: gitlab
|
||||
name: GitLab
|
||||
url: https://gitlab.com/miti99
|
||||
params:
|
||||
icon: brand-gitlab
|
||||
|
||||
- identifier: linkedin
|
||||
name: LinkedIn
|
||||
url: https://linkedin.com/in/miti99
|
||||
params:
|
||||
icon: brand-linkedin
|
||||
|
||||
- identifier: twitter
|
||||
name: Twitter
|
||||
url: https://twitter.com/tienthieusac
|
||||
params:
|
||||
icon: brand-twitter
|
||||
|
||||
- identifier: youtube
|
||||
name: YouTube
|
||||
url: https://youtube.com/@miti99
|
||||
params:
|
||||
icon: brand-youtube
|
||||
|
||||
related:
|
||||
includeNewer: true
|
||||
threshold: 60
|
||||
toLower: false
|
||||
indices:
|
||||
- name: tags
|
||||
weight: 100
|
||||
|
||||
- name: categories
|
||||
weight: 200
|
||||
|
||||
markup:
|
||||
goldmark:
|
||||
extensions:
|
||||
passthrough:
|
||||
enable: true
|
||||
delimiters:
|
||||
block:
|
||||
- - \[
|
||||
- \]
|
||||
- - $$
|
||||
- $$
|
||||
inline:
|
||||
- - \(
|
||||
- \)
|
||||
renderer:
|
||||
## Set to true if you have HTML content inside Markdown
|
||||
unsafe: true
|
||||
tableOfContents:
|
||||
endLevel: 4
|
||||
ordered: true
|
||||
startLevel: 2
|
||||
highlight:
|
||||
noClasses: false
|
||||
codeFences: true
|
||||
guessSyntax: true
|
||||
lineNoStart: 1
|
||||
lineNos: true
|
||||
lineNumbersInTable: true
|
||||
tabWidth: 4
|
||||
@@ -1,5 +0,0 @@
|
||||
{{- $.Scratch.Add "index" slice -}}
|
||||
{{- range .Site.RegularPages -}}
|
||||
{{- $.Scratch.Add "index" (dict "title" .Title "tags" .Params.tags "categories" .Params.categories "contents" .Plain "permalink" .Permalink) -}}
|
||||
{{- end -}}
|
||||
{{- $.Scratch.Get "index" | jsonify -}}
|
||||
@@ -1,23 +0,0 @@
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/3.2.0/fuse.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js"></script>
|
||||
<script src="{{ "js/search.js" | absURL }}"></script>
|
||||
<section class="resume-section p-3 p-lg-5 d-flex flex-column">
|
||||
<div class="my-auto" >
|
||||
<form action="{{ "search" | absURL }}">
|
||||
<input id="search-query" name="s"/>
|
||||
</form>
|
||||
<div id="search-results">
|
||||
<h3>Matching pages</h3>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- this template is sucked in by search.js and appended to the search-results div above. So editing here will adjust style -->
|
||||
<script id="search-result-template" type="text/x-js-template">
|
||||
<div id="summary-${key}">
|
||||
<h4><a href="${link}">${title}</a></h4>
|
||||
<p>${snippet}</p>
|
||||
${ isset tags }<p>Tags: ${tags}</p>${ end }
|
||||
${ isset categories }<p>Categories: ${categories}</p>${ end }
|
||||
</div>
|
||||
</script>
|
||||
|
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |
@@ -1,108 +0,0 @@
|
||||
summaryInclude=60;
|
||||
var fuseOptions = {
|
||||
shouldSort: true,
|
||||
includeMatches: true,
|
||||
threshold: 0.0,
|
||||
tokenize:true,
|
||||
location: 0,
|
||||
distance: 100,
|
||||
maxPatternLength: 32,
|
||||
minMatchCharLength: 1,
|
||||
keys: [
|
||||
{name:"title",weight:0.8},
|
||||
{name:"contents",weight:0.5},
|
||||
{name:"tags",weight:0.3},
|
||||
{name:"categories",weight:0.3}
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
var searchQuery = param("s");
|
||||
if(searchQuery){
|
||||
$("#search-query").val(searchQuery);
|
||||
executeSearch(searchQuery);
|
||||
}else {
|
||||
$('#search-results').append("<p>Please enter a word or phrase above</p>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
function executeSearch(searchQuery){
|
||||
$.getJSON( "/index.json", function( data ) {
|
||||
var pages = data;
|
||||
var fuse = new Fuse(pages, fuseOptions);
|
||||
var result = fuse.search(searchQuery);
|
||||
console.log({"matches":result});
|
||||
if(result.length > 0){
|
||||
populateResults(result);
|
||||
}else{
|
||||
$('#search-results').append("<p>No matches found</p>");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function populateResults(result){
|
||||
$.each(result,function(key,value){
|
||||
var contents= value.item.contents;
|
||||
var snippet = "";
|
||||
var snippetHighlights=[];
|
||||
var tags =[];
|
||||
if( fuseOptions.tokenize ){
|
||||
snippetHighlights.push(searchQuery);
|
||||
}else{
|
||||
$.each(value.matches,function(matchKey,mvalue){
|
||||
if(mvalue.key == "tags" || mvalue.key == "categories" ){
|
||||
snippetHighlights.push(mvalue.value);
|
||||
}else if(mvalue.key == "contents"){
|
||||
start = mvalue.indices[0][0]-summaryInclude>0?mvalue.indices[0][0]-summaryInclude:0;
|
||||
end = mvalue.indices[0][1]+summaryInclude<contents.length?mvalue.indices[0][1]+summaryInclude:contents.length;
|
||||
snippet += contents.substring(start,end);
|
||||
snippetHighlights.push(mvalue.value.substring(mvalue.indices[0][0],mvalue.indices[0][1]-mvalue.indices[0][0]+1));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(snippet.length<1){
|
||||
snippet += contents.substring(0,summaryInclude*2);
|
||||
}
|
||||
//pull template from hugo templarte definition
|
||||
var templateDefinition = $('#search-result-template').html();
|
||||
//replace values
|
||||
var output = render(templateDefinition,{key:key,title:value.item.title,link:value.item.permalink,tags:value.item.tags,categories:value.item.categories,snippet:snippet});
|
||||
$('#search-results').append(output);
|
||||
|
||||
$.each(snippetHighlights,function(snipkey,snipvalue){
|
||||
$("#summary-"+key).mark(snipvalue);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function param(name) {
|
||||
return decodeURIComponent((location.search.split(name + '=')[1] || '').split('&')[0]).replace(/\+/g, ' ');
|
||||
}
|
||||
|
||||
function render(templateString, data) {
|
||||
var conditionalMatches,conditionalPattern,copy;
|
||||
conditionalPattern = /\$\{\s*isset ([a-zA-Z]*) \s*\}(.*)\$\{\s*end\s*}/g;
|
||||
//since loop below depends on re.lastInxdex, we use a copy to capture any manipulations whilst inside the loop
|
||||
copy = templateString;
|
||||
while ((conditionalMatches = conditionalPattern.exec(templateString)) !== null) {
|
||||
if(data[conditionalMatches[1]]){
|
||||
//valid key, remove conditionals, leave contents.
|
||||
copy = copy.replace(conditionalMatches[0],conditionalMatches[2]);
|
||||
}else{
|
||||
//not valid, remove entire section
|
||||
copy = copy.replace(conditionalMatches[0],'');
|
||||
}
|
||||
}
|
||||
templateString = copy;
|
||||
//now any conditionals removed we can do simple substitution
|
||||
var key, find, re;
|
||||
for (key in data) {
|
||||
find = '\\$\\{\\s*' + key + '\\s*\\}';
|
||||
re = new RegExp(find, 'g');
|
||||
templateString = templateString.replace(re, data[key]);
|
||||
}
|
||||
return templateString;
|
||||
}
|
||||