Skip to content

Commit

Permalink
hugo-index
Browse files Browse the repository at this point in the history
  • Loading branch information
rfs85 authored Sep 14, 2024
1 parent 1c8444c commit 6f28263
Show file tree
Hide file tree
Showing 40 changed files with 1,260 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
baseURL: https://website.iothacking101.com
languageCode: en-us
title: LOTHardware
theme: ace
theme: hugo-index
pygmentsUseClasses: true
#enableInlineShortcodes: true
Copyright: 2024 | enesilhaydin
Expand Down
73 changes: 73 additions & 0 deletions themes/hugo-index/.github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Deploy Hugo Index Demo to Pages

on:
push:
paths-ignore:
- "LICENSE"
- "README.md"
branches:
- main
workflow_dispatch:
# manual run
inputs:
hugoVersion:
description: "Hugo Version"
required: false
default: "0.100.0"

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

# Default to bash
defaults:
run:
shell: bash

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: "0.100.0"
steps:
- name: Check version
if: ${{ github.event.inputs.hugoVersion }}
run: export HUGO_VERSION="${{ github.event.inputs.hugoVersion }}"
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
id: pages
uses: actions/configure-pages@v1
- name: Build with Hugo
run: |
cd ./exampleSite && \
hugo \
--buildDrafts --gc --verbose \
--baseURL ${{ steps.pages.outputs.base_url }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./exampleSite/public
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
1 change: 1 addition & 0 deletions themes/hugo-index/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/.hugo_build.lock
21 changes: 21 additions & 0 deletions themes/hugo-index/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Aditya Telange

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
26 changes: 26 additions & 0 deletions themes/hugo-index/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<h1 align=center>Hugo Index | <a href="https://adityatelange.github.io/hugo-index/">Demo</a></h1>

<p align="center">
<kbd><img src="https://user-images.githubusercontent.com/21258296/233713549-07016736-3ca1-46a3-895f-9c08b6cd9145.png" alt="Mockup image" title="Mockup" credits="https://screely.com/"/></kbd>
</p>

---

## Docs

### Variables

| Variable | Value | Description |
| ------------------------------ | ----------- | ----------- |
| `params.showDescriptioninHome` | `true` | |
| `params.hideAllTagsinHome` | `true` | |
| `params.titleIcon` | `index.png` | |
| `params.headers.key` | `Title` | |
| `params.headers.value` | `Tags` | |
| `permalinks.tags` | `@:slug` | |

### Powered by

- [Hugo](https://github.com/gohugoio/hugo) - The world’s fastest framework for building websites.
- [Fuse.js](https://github.com/krisk/Fuse) - Lightweight fuzzy-search, in JavaScript
- [Quicklink](https://github.com/GoogleChromeLabs/quicklink/) - Faster subsequent page-loads by prefetching in-viewport links during idle time
7 changes: 7 additions & 0 deletions themes/hugo-index/archetypes/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
tags:
- default
draft: true
---
86 changes: 86 additions & 0 deletions themes/hugo-index/assets/chromastyles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/* Background */ .bg { background-color: #f0f0f0; }
/* PreWrapper */ .chroma { background-color: #f0f0f0; }
/* Other */ .chroma .x { }
/* Error */ .chroma .err { }
/* CodeLine */ .chroma .cl { }
/* LineLink */ .chroma .lnlinks { outline: none; text-decoration: none; color: inherit }
/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; }
/* LineHighlight */ .chroma .hl { background-color: #ffffcc }
/* LineNumbersTable */ .chroma .lnt { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
/* LineNumbers */ .chroma .ln { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
/* Line */ .chroma .line { display: flex; }
/* Keyword */ .chroma .k { color: #007020; font-weight: bold }
/* KeywordConstant */ .chroma .kc { color: #007020; font-weight: bold }
/* KeywordDeclaration */ .chroma .kd { color: #007020; font-weight: bold }
/* KeywordNamespace */ .chroma .kn { color: #007020; font-weight: bold }
/* KeywordPseudo */ .chroma .kp { color: #007020 }
/* KeywordReserved */ .chroma .kr { color: #007020; font-weight: bold }
/* KeywordType */ .chroma .kt { color: #902000 }
/* Name */ .chroma .n { }
/* NameAttribute */ .chroma .na { color: #4070a0 }
/* NameBuiltin */ .chroma .nb { color: #007020 }
/* NameBuiltinPseudo */ .chroma .bp { }
/* NameClass */ .chroma .nc { color: #0e84b5; font-weight: bold }
/* NameConstant */ .chroma .no { color: #60add5 }
/* NameDecorator */ .chroma .nd { color: #555555; font-weight: bold }
/* NameEntity */ .chroma .ni { color: #d55537; font-weight: bold }
/* NameException */ .chroma .ne { color: #007020 }
/* NameFunction */ .chroma .nf { color: #06287e }
/* NameFunctionMagic */ .chroma .fm { }
/* NameLabel */ .chroma .nl { color: #002070; font-weight: bold }
/* NameNamespace */ .chroma .nn { color: #0e84b5; font-weight: bold }
/* NameOther */ .chroma .nx { }
/* NameProperty */ .chroma .py { }
/* NameTag */ .chroma .nt { color: #062873; font-weight: bold }
/* NameVariable */ .chroma .nv { color: #bb60d5 }
/* NameVariableClass */ .chroma .vc { }
/* NameVariableGlobal */ .chroma .vg { }
/* NameVariableInstance */ .chroma .vi { }
/* NameVariableMagic */ .chroma .vm { }
/* Literal */ .chroma .l { }
/* LiteralDate */ .chroma .ld { }
/* LiteralString */ .chroma .s { color: #4070a0 }
/* LiteralStringAffix */ .chroma .sa { color: #4070a0 }
/* LiteralStringBacktick */ .chroma .sb { color: #4070a0 }
/* LiteralStringChar */ .chroma .sc { color: #4070a0 }
/* LiteralStringDelimiter */ .chroma .dl { color: #4070a0 }
/* LiteralStringDoc */ .chroma .sd { color: #4070a0; font-style: italic }
/* LiteralStringDouble */ .chroma .s2 { color: #4070a0 }
/* LiteralStringEscape */ .chroma .se { color: #4070a0; font-weight: bold }
/* LiteralStringHeredoc */ .chroma .sh { color: #4070a0 }
/* LiteralStringInterpol */ .chroma .si { color: #70a0d0 }
/* LiteralStringOther */ .chroma .sx { color: #c65d09 }
/* LiteralStringRegex */ .chroma .sr { color: #235388 }
/* LiteralStringSingle */ .chroma .s1 { color: #4070a0 }
/* LiteralStringSymbol */ .chroma .ss { color: #517918 }
/* LiteralNumber */ .chroma .m { color: #40a070 }
/* LiteralNumberBin */ .chroma .mb { color: #40a070 }
/* LiteralNumberFloat */ .chroma .mf { color: #40a070 }
/* LiteralNumberHex */ .chroma .mh { color: #40a070 }
/* LiteralNumberInteger */ .chroma .mi { color: #40a070 }
/* LiteralNumberIntegerLong */ .chroma .il { color: #40a070 }
/* LiteralNumberOct */ .chroma .mo { color: #40a070 }
/* Operator */ .chroma .o { color: #666666 }
/* OperatorWord */ .chroma .ow { color: #007020; font-weight: bold }
/* Punctuation */ .chroma .p { }
/* Comment */ .chroma .c { color: #60a0b0; font-style: italic }
/* CommentHashbang */ .chroma .ch { color: #60a0b0; font-style: italic }
/* CommentMultiline */ .chroma .cm { color: #60a0b0; font-style: italic }
/* CommentSingle */ .chroma .c1 { color: #60a0b0; font-style: italic }
/* CommentSpecial */ .chroma .cs { color: #60a0b0; background-color: #fff0f0 }
/* CommentPreproc */ .chroma .cp { color: #007020 }
/* CommentPreprocFile */ .chroma .cpf { color: #007020 }
/* Generic */ .chroma .g { }
/* GenericDeleted */ .chroma .gd { color: #a00000 }
/* GenericEmph */ .chroma .ge { font-style: italic }
/* GenericError */ .chroma .gr { color: #ff0000 }
/* GenericHeading */ .chroma .gh { color: #000080; font-weight: bold }
/* GenericInserted */ .chroma .gi { color: #00a000 }
/* GenericOutput */ .chroma .go { color: #888888 }
/* GenericPrompt */ .chroma .gp { color: #c65d09; font-weight: bold }
/* GenericStrong */ .chroma .gs { font-weight: bold }
/* GenericSubheading */ .chroma .gu { color: #800080; font-weight: bold }
/* GenericTraceback */ .chroma .gt { color: #0044dd }
/* GenericUnderline */ .chroma .gl { text-decoration: underline }
/* TextWhitespace */ .chroma .w { color: #bbbbbb }
50 changes: 50 additions & 0 deletions themes/hugo-index/assets/search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import * as params from '@params';

let fuse;
let searchBox = document.getElementById('search');
let resList = document.getElementById('tableListBody');

window.onload = () => {
fetch(params.BaseURL + 'index.json')
.then(res => res.json())
.then(data => {
const options = {
distance: 100,
threshold: 0.0,
ignoreLocation: true,
keys: [
'title',
'tags.title',
]
};
const myIndex = Fuse.createIndex(options.keys, data)
fuse = new Fuse(data, options, myIndex);
});
}

searchBox.addEventListener('input', () => {
let resultSet = '';
let results = fuse.search(searchBox.value);
if (results.length !== 0) {
for (let item in results) {
let tagList = '';
if (results[item].item.tags) {
results[item].item.tags.forEach(tag => {
tagList += `<li><a href="${tag.permalink}">${tag.title}</a></li>`
});
}
resultSet += `<tr><td><a href="${results[item].item.permalink}">${results[item].item.title}</a></td><td><ul class="tagsList">${tagList}</ul></td></tr>`
}
} else {
for (let item of fuse.getIndex().docs) {
let tagList = '';
if (item.tags) {
item.tags.forEach(tag => {
tagList += `<li><a href="${tag.permalink}">${tag.title}</a></li>`
});
}
resultSet += `<tr><td><a href="${item.permalink}">${item.title}</a></td><td><ul class="tagsList">${tagList}</ul></td></tr>`
}
}
resList.innerHTML = resultSet;
})
Loading

0 comments on commit 6f28263

Please sign in to comment.