Skip to content

Commit

Permalink
render pilot website
Browse files Browse the repository at this point in the history
  • Loading branch information
unpilbaek committed Jul 19, 2024
1 parent 45b6988 commit 7c03c87
Show file tree
Hide file tree
Showing 40 changed files with 1,428 additions and 158 deletions.
Binary file added .DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata

/.quarto/
14 changes: 3 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# Quarto Template for the Tutorial
# Unpil Baek

This repository contains the template for the website tutorial at <https://www.marvinschmitt.com/blog/website-tutorial-quarto/>.
Personal website built with Quarto.

<p align="center">
<img src="img/website_template_screenshot_1.png" width="45%">
&nbsp; &nbsp; &nbsp; &nbsp;
<img src="img/website_template_screenshot_2.png" width="45%">
<br/><br/>
<img src="img/website_template_screenshot_3.png" width="45%">
&nbsp; &nbsp; &nbsp; &nbsp;
<img src="img/website_template_screenshot_4.png" width="45%">
</p>
Looking for a nice tutorial? Try this: <https://www.marvinschmitt.com/blog/website-tutorial-quarto/>.
5 changes: 3 additions & 2 deletions _freeze/cv/index/execute-results/html.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"hash": "c1396f1f9307a539f1597a232ceb2381",
"hash": "b3aee84c0030d141a32dbd03d6681475",
"result": {
"markdown": "---\nlayout: page\ntitle: Curriculum vitae\nexcerpt: My current CV\nexecute:\n freeze: true # never re-render during project render\nengine: knitr \nresources:\n - \"cv.pdf\"\ncv:\n pdf: \"cv.pdf\"\n---\n\n::: {.cell}\n<style type=\"text/css\">\n.embed-container {\n position: relative;\n padding-bottom: 129%;\n height: 0;\n overflow: hidden;\n max-width: 100%;\n}\n.embed-container iframe,\n.embed-container object,\n.embed-container embed {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n</style>\n:::\n\n```{=html}\n<p class=\"text-center\">\n <a class=\"btn btn-primary btn-lg cv-download\" href=\"cv.pdf\" target=\"_blank\">\n <i class=\"fa-solid fa-file-arrow-down\"></i>&ensp;Download current CV\n </a>\n</p>\n<div class=\"embed-container\">\n <iframe src=\"cv.pdf#toolbar=0\" style=\"border: 0.5px;width: 100%;\"></iframe>\n</div>\n```\n\n```{=html}\n<div style=\"margin: 30px; text-align: center;\">\n<a class=\"btn btn-primary\" href=\"https://www.marvinschmitt.com/blog/website-tutorial-quarto/\" role=\"button\" target=\"_blank\" style=\"padding: 15px 30px;\">View the tutorial for this template (+ download link)</a>\n</div>\n```",
"engine": "knitr",
"markdown": "---\nlayout: page\ntitle: Curriculum vitae\nexcerpt: My current CV\nexecute:\n freeze: true # never re-render during project render\nengine: knitr \nresources:\n - \"cv.pdf\"\ncv:\n pdf: \"cv.pdf\"\n---\n\n::: {.cell}\n<style type=\"text/css\">\n.embed-container {\n position: relative;\n padding-bottom: 129%;\n height: 0;\n overflow: hidden;\n max-width: 100%;\n}\n.embed-container iframe,\n.embed-container object,\n.embed-container embed {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n</style>\n:::\n\n```{=html}\n<p class=\"text-center\">\n <a class=\"btn btn-primary btn-lg cv-download\" href=\"cv.pdf\" target=\"_blank\">\n <i class=\"fa-solid fa-file-arrow-down\"></i>&ensp;Download current CV\n </a>\n</p>\n<div class=\"embed-container\">\n <iframe src=\"cv.pdf#toolbar=0\" style=\"border: 0.5px;width: 100%;\"></iframe>\n</div>\n```\n",
"supporting": [],
"filters": [
"rmarkdown/pagebreak.lua"
Expand Down
2 changes: 2 additions & 0 deletions _freeze/site_libs/quarto-listing/list.min.js

Large diffs are not rendered by default.

243 changes: 243 additions & 0 deletions _freeze/site_libs/quarto-listing/quarto-listing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
const kProgressiveAttr = "data-src";
let categoriesLoaded = false;

window.quartoListingCategory = (category) => {
if (categoriesLoaded) {
activateCategory(category);
setCategoryHash(category);
}
};

window["quarto-listing-loaded"] = () => {
// Process any existing hash
const hash = getHash();

if (hash) {
// If there is a category, switch to that
if (hash.category) {
activateCategory(hash.category);
}
// Paginate a specific listing
const listingIds = Object.keys(window["quarto-listings"]);
for (const listingId of listingIds) {
const page = hash[getListingPageKey(listingId)];
if (page) {
showPage(listingId, page);
}
}
}

const listingIds = Object.keys(window["quarto-listings"]);
for (const listingId of listingIds) {
// The actual list
const list = window["quarto-listings"][listingId];

// Update the handlers for pagination events
refreshPaginationHandlers(listingId);

// Render any visible items that need it
renderVisibleProgressiveImages(list);

// Whenever the list is updated, we also need to
// attach handlers to the new pagination elements
// and refresh any newly visible items.
list.on("updated", function () {
renderVisibleProgressiveImages(list);
setTimeout(() => refreshPaginationHandlers(listingId));

// Show or hide the no matching message
toggleNoMatchingMessage(list);
});
}
};

window.document.addEventListener("DOMContentLoaded", function (_event) {
// Attach click handlers to categories
const categoryEls = window.document.querySelectorAll(
".quarto-listing-category .category"
);

for (const categoryEl of categoryEls) {
const category = categoryEl.getAttribute("data-category");
categoryEl.onclick = () => {
activateCategory(category);
setCategoryHash(category);
};
}

// Attach a click handler to the category title
// (there should be only one, but since it is a class name, handle N)
const categoryTitleEls = window.document.querySelectorAll(
".quarto-listing-category-title"
);
for (const categoryTitleEl of categoryTitleEls) {
categoryTitleEl.onclick = () => {
activateCategory("");
setCategoryHash("");
};
}

categoriesLoaded = true;
});

function toggleNoMatchingMessage(list) {
const selector = `#${list.listContainer.id} .listing-no-matching`;
const noMatchingEl = window.document.querySelector(selector);
if (noMatchingEl) {
if (list.visibleItems.length === 0) {
noMatchingEl.classList.remove("d-none");
} else {
if (!noMatchingEl.classList.contains("d-none")) {
noMatchingEl.classList.add("d-none");
}
}
}
}

function setCategoryHash(category) {
setHash({ category });
}

function setPageHash(listingId, page) {
const currentHash = getHash() || {};
currentHash[getListingPageKey(listingId)] = page;
setHash(currentHash);
}

function getListingPageKey(listingId) {
return `${listingId}-page`;
}

function refreshPaginationHandlers(listingId) {
const listingEl = window.document.getElementById(listingId);
const paginationEls = listingEl.querySelectorAll(
".pagination li.page-item:not(.disabled) .page.page-link"
);
for (const paginationEl of paginationEls) {
paginationEl.onclick = (sender) => {
setPageHash(listingId, sender.target.getAttribute("data-i"));
showPage(listingId, sender.target.getAttribute("data-i"));
return false;
};
}
}

function renderVisibleProgressiveImages(list) {
// Run through the visible items and render any progressive images
for (const item of list.visibleItems) {
const itemEl = item.elm;
if (itemEl) {
const progressiveImgs = itemEl.querySelectorAll(
`img[${kProgressiveAttr}]`
);
for (const progressiveImg of progressiveImgs) {
const srcValue = progressiveImg.getAttribute(kProgressiveAttr);
if (srcValue) {
progressiveImg.setAttribute("src", srcValue);
}
progressiveImg.removeAttribute(kProgressiveAttr);
}
}
}
}

function getHash() {
// Hashes are of the form
// #name:value|name1:value1|name2:value2
const currentUrl = new URL(window.location);
const hashRaw = currentUrl.hash ? currentUrl.hash.slice(1) : undefined;
return parseHash(hashRaw);
}

const kAnd = "&";
const kEquals = "=";

function parseHash(hash) {
if (!hash) {
return undefined;
}
const hasValuesStrs = hash.split(kAnd);
const hashValues = hasValuesStrs
.map((hashValueStr) => {
const vals = hashValueStr.split(kEquals);
if (vals.length === 2) {
return { name: vals[0], value: vals[1] };
} else {
return undefined;
}
})
.filter((value) => {
return value !== undefined;
});

const hashObj = {};
hashValues.forEach((hashValue) => {
hashObj[hashValue.name] = decodeURIComponent(hashValue.value);
});
return hashObj;
}

function makeHash(obj) {
return Object.keys(obj)
.map((key) => {
return `${key}${kEquals}${obj[key]}`;
})
.join(kAnd);
}

function setHash(obj) {
const hash = makeHash(obj);
window.history.pushState(null, null, `#${hash}`);
}

function showPage(listingId, page) {
const list = window["quarto-listings"][listingId];
if (list) {
list.show((page - 1) * list.page + 1, list.page);
}
}

function activateCategory(category) {
// Deactivate existing categories
const activeEls = window.document.querySelectorAll(
".quarto-listing-category .category.active"
);
for (const activeEl of activeEls) {
activeEl.classList.remove("active");
}

// Activate this category
const categoryEl = window.document.querySelector(
`.quarto-listing-category .category[data-category='${category}'`
);
if (categoryEl) {
categoryEl.classList.add("active");
}

// Filter the listings to this category
filterListingCategory(category);
}

function filterListingCategory(category) {
const listingIds = Object.keys(window["quarto-listings"]);
for (const listingId of listingIds) {
const list = window["quarto-listings"][listingId];
if (list) {
if (category === "") {
// resets the filter
list.filter();
} else {
// filter to this category
list.filter(function (item) {
const itemValues = item.values();
if (itemValues.categories !== null) {
const categories = itemValues.categories.split(",");
return categories.includes(category);
} else {
return false;
}
});
}
}
}
}
13 changes: 9 additions & 4 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ website:
left:
- text: "Projects"
href: projects/index.qmd
- text: "Photography"
href: photography/index.qmd
- text: "Music"
href: music/index.qmd
- text: "CV"
href: cv/index.qmd
- text: "Blog"
href: posts.qmd

# your social media handles
right:
Expand All @@ -29,6 +31,8 @@ website:
# href: https://twitter.com/MarvinSchmittML
- icon: linkedin
href: https://www.linkedin.com/in/unpilbaek/
- icon: github
href: https://github.com/unpilbaek/
#- icon: envelope
# aria-label: email
# href: "mailto:[email protected]"
Expand Down Expand Up @@ -64,11 +68,12 @@ format:
html:
fontsize: 1.1em
theme:
- pulse
- trestles
- html/styles.scss
toc: false
code-link: true
anchor-sections: true
fig-cap-location: margin
reference-location: margin
footnotes-hover: true
footnotes-hover: true
page-layout: full
Binary file added cv/.DS_Store
Binary file not shown.
Binary file modified cv/cv.pdf
Binary file not shown.
8 changes: 0 additions & 8 deletions cv/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,3 @@ cv:
<iframe src="`r rmarkdown::metadata$cv$pdf`#toolbar=0" style="border: 0.5px;width: 100%;"></iframe>
</div>
```



```{=html}
<div style="margin: 30px; text-align: center;">
<a class="btn btn-primary" href="https://www.marvinschmitt.com/blog/website-tutorial-quarto/" role="button" target="_blank" style="padding: 15px 30px;">View the tutorial for this template (+ download link)</a>
</div>
```
21 changes: 15 additions & 6 deletions docs/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

</head>

<body class="nav-fixed fullcontent">
<body class="nav-fixed">

<div id="quarto-search-results"></div>
<header id="quarto-header" class="headroom fixed-top">
Expand All @@ -94,18 +94,27 @@
<span class="menu-text">Projects</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/photography/index.html">
<span class="menu-text">Photography</span></a>
<a class="nav-link" href="/music/index.html">
<span class="menu-text">Music</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/cv/index.html">
<span class="menu-text">CV</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/posts.html">
<span class="menu-text">Blog</span></a>
</li>
</ul>
<ul class="navbar-nav navbar-nav-scroll ms-auto">
<li class="nav-item compact">
<a class="nav-link" href="https://www.linkedin.com/in/unpilbaek/"> <i class="bi bi-linkedin" role="img">
</i>
<span class="menu-text"></span></a>
</li>
<li class="nav-item compact">
<a class="nav-link" href="https://github.com/unpilbaek/"> <i class="bi bi-github" role="img">
</i>
<span class="menu-text"></span></a>
</li>
</ul>
Expand All @@ -116,12 +125,12 @@
</nav>
</header>
<!-- content -->
<div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
<div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-full page-navbar">
<!-- sidebar -->
<!-- margin-sidebar -->

<!-- main -->
<main class="content" id="quarto-document-content">
<main class="content column-page" id="quarto-document-content">

<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
Expand All @@ -130,7 +139,7 @@ <h1 class="title">404</h1>



<div class="quarto-title-meta">
<div class="quarto-title-meta column-page">



Expand Down
Binary file modified docs/cv/cv.pdf
Binary file not shown.
Loading

0 comments on commit 7c03c87

Please sign in to comment.