mirror of
https://github.com/Superredstone/patrickcanal.it.git
synced 2026-03-07 20:18:08 +01:00
First commit
This commit is contained in:
300
public/search/index.html
Normal file
300
public/search/index.html
Normal file
@@ -0,0 +1,300 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="" lang="en-us"><head><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script>
|
||||
|
||||
<meta name="robots" content="noai, noimageai">
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=7" />
|
||||
|
||||
<link
|
||||
rel="icon"
|
||||
href='/favicon.png'
|
||||
/>
|
||||
<link
|
||||
rel="shortcut icon"
|
||||
href='/favicon.ico'
|
||||
type="image/x-icon"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
href='/apple-touch-icon.png'
|
||||
/>
|
||||
|
||||
<link
|
||||
rel="icon"
|
||||
href='logo.svg'
|
||||
type="image/svg+xml"
|
||||
/>
|
||||
|
||||
<title>
|
||||
|
||||
Search –
|
||||
|
||||
Patrick Canal
|
||||
</title>
|
||||
|
||||
|
||||
<link href="/symbols-nerd-font/symbols-nerd-font.css" rel="stylesheet" />
|
||||
<link href="/jetbrains-mono/jetbrains-mono.css" rel="stylesheet" />
|
||||
|
||||
|
||||
|
||||
<link type="text/css" rel="stylesheet" href=http://localhost:1313/css/styles.abbd6311bb4b6ca58f8e7398140529245ae0f6428b759fcd830742eee2619eabb900ba9914a9affb82aa9a16a9b9ea727bb315315a976a0db0e7513a5f12c504.css integrity="sha512-q71jEbtLbKWPjnOYFAUpJFrg9kKLdZ/NgwdC7uJhnqu5ALqZFKmv+4Kqmhapuepye7MVMVqXag2w51E6XxLFBA==" />
|
||||
<meta name="author" content="Patrick Canal" />
|
||||
|
||||
|
||||
|
||||
<meta name="description" content="" />
|
||||
|
||||
|
||||
<meta property="og:site_name"
|
||||
content='Patrick Canal' />
|
||||
|
||||
<meta property="og:title" content="Search" />
|
||||
<meta property="og:type" content="article" />
|
||||
|
||||
<meta
|
||||
property="article:author" content="Patrick Canal" />
|
||||
|
||||
<meta
|
||||
property="article:published_time"
|
||||
content='0001-01-01T00:00:00Z+0000' />
|
||||
|
||||
<meta property="og:url" content="http://localhost:1313/search/" />
|
||||
|
||||
|
||||
<meta property="og:image"
|
||||
content="http://localhost:1313/img/icon.svg" />
|
||||
|
||||
<meta property="og:description" content="" />
|
||||
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta property="twitter:domain"
|
||||
content='localhost:1313'
|
||||
/>
|
||||
<meta property="twitter:url" content="http://localhost:1313/search/" />
|
||||
|
||||
|
||||
<meta name="twitter:title" content="Search" />
|
||||
|
||||
|
||||
|
||||
<meta name="twitter:image"
|
||||
content="http://localhost:1313/img/icon.svg" />
|
||||
|
||||
<meta name="twitter:description" content="" />
|
||||
|
||||
|
||||
<link rel="manifest" href="/manifest/index.json" />
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<div id="baseContainer"><header class="">
|
||||
<div class="titleAndSearchContainer">
|
||||
<div id="titleContainer">
|
||||
|
||||
<a class="unstyledLink" href="/">
|
||||
<img src='logo.svg' alt='Logo'/>
|
||||
</a>
|
||||
|
||||
<div class="rightOfLogo">
|
||||
<div class="titleAndHamburger">
|
||||
<h1>
|
||||
<a class="unstyledLink" href="/">Patrick Canal</a>
|
||||
|
||||
</h1>
|
||||
|
||||
</div>
|
||||
<div id="wide_nav"><nav>
|
||||
|
||||
<ul id="main-nav">
|
||||
<li><a href="/">Home</a></li>
|
||||
|
||||
<li><a href="/posts/">Posts</a></li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li><a href="/tags/">Tags</a></li>
|
||||
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="links">
|
||||
<a
|
||||
|
||||
rel="noreferrer"
|
||||
|
||||
target="_blank"
|
||||
class="nerdlink"
|
||||
href="/index.xml">
|
||||
|
||||
|
||||

|
||||
|
||||
<span>
|
||||
RSS
|
||||
</span>
|
||||
</a>
|
||||
|
||||
|
||||
<a
|
||||
|
||||
rel="noreferrer"
|
||||
|
||||
target="_blank"
|
||||
class="nerdlink"
|
||||
href="https://github.com/Superredstone">
|
||||
|
||||
|
||||

|
||||
|
||||
<span>
|
||||
Github
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</header>
|
||||
<div id="contentContainer">
|
||||
<div id="content">
|
||||
<main>
|
||||
<noscript>
|
||||
You need to enable JavaScript to be able to search.
|
||||
</noscript><div class="search">
|
||||
<input id="searchbar" type="text" placeholder='Search' />
|
||||
<span class="nerdlink" onclick="newSearch();"></span>
|
||||
</div>
|
||||
<script>
|
||||
function newSearch() {
|
||||
let term = searchbar.value.trim();
|
||||
if (!term) return;
|
||||
location.href = `/search/?q=${term}`;
|
||||
}
|
||||
searchbar.onkeyup = (ev) => {if (ev.keyCode == 13) newSearch()};
|
||||
</script>
|
||||
<div class="postlist " id="postlist">
|
||||
</div><script>
|
||||
const tagsStr = 'Tags'
|
||||
|
||||
function renderTags(tags) {
|
||||
if (tags.length <= 0) return '';
|
||||
let res = `| <span title=''> </span>`;
|
||||
for (let tag of tags) {
|
||||
|
||||
res += `<a href="/tags/${tag}/">#${tag}</a> `;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
function renderImage(image, link, alt) {
|
||||
if (!image) return '';
|
||||
return `<a href="${link}"><img src="${image}" alt="${alt}" /></a>`;
|
||||
}
|
||||
function renderSingleArticle(article) {
|
||||
|
||||
const tags = renderTags(article.tags)
|
||||
|
||||
|
||||
|
||||
const img = ''
|
||||
|
||||
|
||||
|
||||
const continueReadingStr = 'Continue reading'
|
||||
const summ = `<div class="articlePreview">
|
||||
<p>${article.summary}</p>
|
||||
<p><a href="${article.link}">${continueReadingStr} </a></p>
|
||||
</div>`
|
||||
|
||||
|
||||
const dateStr = 'Date'
|
||||
|
||||
return `
|
||||
<article class="card postlistitem">
|
||||
<div>
|
||||
<h2>
|
||||
<a href="${article.link}">${article.title}</a>
|
||||
</h2>
|
||||
<p class="date">
|
||||
<span title='${dateStr}'> </span>
|
||||
${article.date}
|
||||
${tags}
|
||||
</p>
|
||||
${img}
|
||||
${summ}
|
||||
</div>
|
||||
<hr />
|
||||
</article>
|
||||
`;
|
||||
}
|
||||
function renderArticles(articles) {
|
||||
let rendered = articles.map(a => renderSingleArticle(a)).join('\n');
|
||||
document.getElementById('postlist').innerHTML += rendered;
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
const noResFoundStr = "No results found"
|
||||
function matchTags(page, term) {
|
||||
for (let tag of page.tags) {
|
||||
if (tag.includes(term)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function performSearch(term) {
|
||||
document.getElementById('postlist').innerHTML = '';
|
||||
term = term.toLowerCase();
|
||||
fetch('/search/index.json').then(res => res.json())
|
||||
.then(res => {
|
||||
let articles = res.pages.filter(page => (
|
||||
page.title.toLowerCase().includes(term) ||
|
||||
matchTags(page, term) ||
|
||||
page.text.includes(term)
|
||||
));
|
||||
if (articles.length > 0) renderArticles(articles);
|
||||
else document.getElementById('postlist').innerHTML = `
|
||||
<h3>${noResFoundStr}</h3>
|
||||
`;
|
||||
});
|
||||
}
|
||||
var url = location.href;
|
||||
var baseUrl = url.split('?')[0];
|
||||
var searchbar = document.getElementById('searchbar');
|
||||
if (url.includes('?')) {
|
||||
var urlParams = new URLSearchParams(url.split('?')[1]);
|
||||
if (urlParams.has('q')) {
|
||||
let searchTerm = urlParams.get('q');
|
||||
searchbar.value = searchTerm;
|
||||
performSearch(searchTerm);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</main><footer>
|
||||
<hr />
|
||||
|
||||
<p><small>
|
||||
2025 © Patrick Canal
|
||||
</small></p>
|
||||
<p><small>
|
||||
<a href='https://gitlab.com/gabmus/hugo-ficurinia'>Ficurinia theme</a> for <a href='https://gohugo.io'>Hugo</a> by <a href='https://gabmus.org'>Gabriele Musco</a>. Licensed under <a href='https://www.gnu.org/licenses/agpl-3.0.html'>GNU AGPLv3</a>.
|
||||
</small></p>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
13
public/search/index.json
Normal file
13
public/search/index.json
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"pages": [{"date":"2025-04-07","image":"","imageAlt":"","link":"http://localhost:1313/posts/building-my-website-in-hugo/","summary":"\u003cp\u003eI always wanted a website/blog to write articles about what I like, so today I decided to make one!\u003c/p\u003e\n\u003cp\u003eAfter buying a domain and setting up the server I had just to decide what to write the website with.\u003c/p\u003e\n\u003ch2 id=\"hugo\"\u003eHugo\u003c/h2\u003e\n\u003cp\u003eAs a tech stack I wanted something simple and easy to mantain,\n\u003ca href=\"https://gohugo.io/\"\u003eHugo\u003c/a\u003e makes everything so easy and painless that it is too good to be true.\u003c/p\u003e\n\u003cp\u003eJust install it and then write in the terminal\u003c/p\u003e","tags":["hosting","website"],"text":"i always wanted a website/blog to write articles about what i like, so today i decided to make one!\nafter buying a domain and setting up the server i had just to decide what to write the website with.\nhugo as a tech stack i wanted something simple and easy to mantain, hugo makes everything so easy and painless that it is too good to be true.\njust install it and then write in the terminal\nhugo new site \u0026lt;website-name\u0026gt; \u0026amp;\u0026amp; cd \u0026lt;website-name\u0026gt; to generate the template, install a good-looking theme from the themes page on the hugo website, in my case ficurinia\ngit clone https://github.com/patrickacciaioli/ficurinia themes/ficurinia add the following line inside of hugo.toml with the greatest editor ever lived (vim)\ntheme = \u0026#34;ficurinia\u0026#34; start the server with\nhugo server and you are ready to go. a complete blog in seconds.\nconclusion building a personal website with hugo was faster and easier than i could have ever done in plain html. with minimal setup and maximum flexibility, hugo proved to be the perfect choice for my blog. now, i can focus on writing posts worrying about the infamous hypertext markup language.\n","title":"Building my website in Hugo"}]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user