mirror of
https://github.com/tiennm99/miti99.git
synced 2026-09-10 02:17:41 +00:00
[Add] auto list Github pages
This commit is contained in:
+7
-7
@@ -54,7 +54,7 @@ outputs:
|
||||
|
||||
params:
|
||||
env: production
|
||||
description: "miti99's blog"
|
||||
description: "miti99"
|
||||
author: miti99
|
||||
|
||||
defaultTheme: auto
|
||||
@@ -75,22 +75,22 @@ params:
|
||||
|
||||
profileMode:
|
||||
enabled: true
|
||||
title: miti99's blog
|
||||
title: miti99
|
||||
subtitle: Một lập trình viên muốn trở thành phù thuỷ
|
||||
imageUrl: "img/avatar.jpg"
|
||||
imageTitle: miti99's avatar
|
||||
imageWidth: 256
|
||||
imageHeight: 256
|
||||
buttons:
|
||||
- name: Archives
|
||||
url: archives
|
||||
- name: Web CV
|
||||
url: https://tiennm99.github.io
|
||||
url: https://tiennm99.github.io/webcv
|
||||
- name: PDF CV
|
||||
url: https://cv.miti99.eu.org/miti99.pdf
|
||||
url: https://tiennm99.github.io/cv/miti99.pdf
|
||||
- name: Pages
|
||||
url: pages
|
||||
|
||||
homeInfoParams:
|
||||
Title: "miti99's blog"
|
||||
Title: "miti99"
|
||||
Content: >
|
||||
👋 Chào mừng đến với blog của miti99. Web được tạo ra bởi miti99, sử dụng Hugo và theme PaperMod!
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
---
|
||||
title: "Misc"
|
||||
slug: "misc"
|
||||
---
|
||||
|
||||
https://cv.miti99.eu.org/miti99.pdf
|
||||
|
||||
https://beentogether.miti99.eu.org
|
||||
|
||||
https://dentalvisit.miti99.eu.org
|
||||
|
||||
https://demngayxaem.miti99.eu.org
|
||||
|
||||
https://loto.miti99.eu.org
|
||||
|
||||
https://maibd2021.miti99.eu.org
|
||||
|
||||
https://apart.miti99.eu.org
|
||||
|
||||
https://hurt.miti99.eu.org
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "Pages"
|
||||
slug: "pages"
|
||||
---
|
||||
|
||||
Danh sách những trang mình host trên [GitHub Pages](https://pages.github.com/). Thường khá thú vị :>
|
||||
|
||||
_(Danh sách này được tạo tự động nên thứ tự không quan trọng nhé)_
|
||||
|
||||
{{< github-pages >}}
|
||||
@@ -0,0 +1,62 @@
|
||||
<div id="github-pages">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>Pages URL</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="repos">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const username = "tiennm99";
|
||||
const type = "all";
|
||||
const perPage = 100;
|
||||
let page = 1;
|
||||
|
||||
function fetchRepos(page) {
|
||||
const url = `https://api.github.com/users/${username}/repos?type=${type}&per_page=${perPage}&page=${page}`;
|
||||
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error("HTTP error " + response.status);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
if (data.length === 0) {
|
||||
// No more repositories to fetch
|
||||
return;
|
||||
}
|
||||
|
||||
const table = document.getElementById("repos");
|
||||
data.forEach(repo => {
|
||||
if (repo.has_pages) {
|
||||
const row = table.insertRow(-1);
|
||||
const nameCell = row.insertCell(0);
|
||||
const descriptionCell = row.insertCell(1);
|
||||
const urlCell = row.insertCell(2);
|
||||
|
||||
const repoUrl = `https://github.com/${username}/${repo.name}`;
|
||||
const pagesUrl = repo.homepage;
|
||||
|
||||
nameCell.innerHTML = `<a href="${repoUrl}" target="_blank">${repo.name}</a>`;
|
||||
descriptionCell.textContent = repo.description;
|
||||
urlCell.innerHTML = `<a href="${pagesUrl}" target="_blank">${pagesUrl}</a>`;
|
||||
}
|
||||
});
|
||||
|
||||
// Fetch the next page
|
||||
fetchRepos(page + 1);
|
||||
})
|
||||
.catch(error => console.error("Error:", error));
|
||||
}
|
||||
|
||||
// Start fetching repositories
|
||||
fetchRepos(page);
|
||||
</script>
|
||||
Reference in New Issue
Block a user