index is now a md file, fallback to README, fallback to info about how to setup the index page
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending
This commit is contained in:
parent
fbde0a07c6
commit
978cc48a57
5 changed files with 26 additions and 65 deletions
|
@ -18,6 +18,7 @@ WORKDIR /app
|
||||||
|
|
||||||
COPY --from=builder /usr/local/cargo/bin/ewp /app/ewp
|
COPY --from=builder /usr/local/cargo/bin/ewp /app/ewp
|
||||||
COPY --from=builder /usr/src/ewp/LICENSE /app/LICENSE
|
COPY --from=builder /usr/src/ewp/LICENSE /app/LICENSE
|
||||||
|
COPY --from=builder /usr/src/ewp/README.md /app/README.md
|
||||||
COPY --from=builder /usr/src/ewp/static /app/static
|
COPY --from=builder /usr/src/ewp/static /app/static
|
||||||
COPY --from=builder /usr/src/ewp/templates /app/templates
|
COPY --from=builder /usr/src/ewp/templates /app/templates
|
||||||
|
|
||||||
|
|
|
@ -6,4 +6,4 @@ Easy WebPage generator
|
||||||
[![status-badge](https://ci.mylloon.fr/api/badges/Anri/mylloon.fr/status.svg)](https://ci.mylloon.fr/Anri/mylloon.fr)
|
[![status-badge](https://ci.mylloon.fr/api/badges/Anri/mylloon.fr/status.svg)](https://ci.mylloon.fr/Anri/mylloon.fr)
|
||||||
|
|
||||||
- See [issues](https://git.mylloon.fr/Anri/mylloon.fr/issues)
|
- See [issues](https://git.mylloon.fr/Anri/mylloon.fr/issues)
|
||||||
- See [documentation](./Documentation.md)
|
- See [documentation](https://git.mylloon.fr/Anri/mylloon.fr/src/branch/main/Documentation.md)
|
||||||
|
|
|
@ -4,7 +4,10 @@ use ramhorns::Content;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
config::Config,
|
config::Config,
|
||||||
misc::utils::{make_kw, Html},
|
misc::{
|
||||||
|
markdown::{read_file, File, TypeFileMetadata},
|
||||||
|
utils::{make_kw, Html},
|
||||||
|
},
|
||||||
template::{Infos, NavBar},
|
template::{Infos, NavBar},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -17,10 +20,20 @@ async fn page(config: web::Data<Config>) -> impl Responder {
|
||||||
struct IndexTemplate {
|
struct IndexTemplate {
|
||||||
navbar: NavBar,
|
navbar: NavBar,
|
||||||
fullname: String,
|
fullname: String,
|
||||||
|
content: Option<File>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[once(time = 60)]
|
#[once(time = 60)]
|
||||||
fn build_page(config: Config) -> String {
|
fn build_page(config: Config) -> String {
|
||||||
|
let mut content = read_file(
|
||||||
|
&format!("{}/index.md", config.locations.data_dir),
|
||||||
|
TypeFileMetadata::Generic,
|
||||||
|
);
|
||||||
|
|
||||||
|
if content.is_none() {
|
||||||
|
content = read_file("README.md", TypeFileMetadata::Generic);
|
||||||
|
}
|
||||||
|
|
||||||
config.tmpl.render(
|
config.tmpl.render(
|
||||||
"index.html",
|
"index.html",
|
||||||
IndexTemplate {
|
IndexTemplate {
|
||||||
|
@ -33,11 +46,12 @@ fn build_page(config: Config) -> String {
|
||||||
.fullname
|
.fullname
|
||||||
.to_owned()
|
.to_owned()
|
||||||
.unwrap_or("Fullname".to_owned()),
|
.unwrap_or("Fullname".to_owned()),
|
||||||
|
content,
|
||||||
},
|
},
|
||||||
Infos {
|
Infos {
|
||||||
page_title: config.fc.fullname,
|
page_title: config.fc.fullname,
|
||||||
page_desc: Some("Page principale".into()),
|
page_desc: Some("Page principale".into()),
|
||||||
page_kw: make_kw(&["index", "étudiant"]),
|
page_kw: make_kw(&["index", "étudiant", "accueil"]),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,8 +64,8 @@ h1 {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#friends a {
|
#friends a:not(h1 > a) {
|
||||||
padding-right: 10px;
|
padding-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#friends h1 {
|
#friends h1 {
|
||||||
|
|
|
@ -22,66 +22,12 @@
|
||||||
</div>
|
</div>
|
||||||
<p id="subname"></p>
|
<p id="subname"></p>
|
||||||
|
|
||||||
<article>
|
{{#content}} {{&content}} {{/content}} {{^content}}
|
||||||
<h1>Qui suis-je ?</h1>
|
|
||||||
<p>Je m'appelle <b>Anri</b>, mon pseudo est <b>Mylloon</b>.</p>
|
|
||||||
<p>
|
<p>
|
||||||
J'aime beaucoup l'informatique depuis très petit, ce site est écrit de
|
<b>Welcome to EWP</b>, create a <code>index.md</code> file inside your
|
||||||
A à Z par moi-même (modulo la quantité astronomique de librairie
|
<code>data/</code> directory to get started.
|
||||||
utilisé) en Rust. J'adore le monde de l'open source, l'immense
|
|
||||||
majorité de mes projets sont sous licence
|
|
||||||
<a
|
|
||||||
href="https://en.wikipedia.org/wiki/GNU_Affero_General_Public_License"
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
>AGPLv3</a
|
|
||||||
>.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
{{/content}} {{/data}}
|
||||||
En ce moment, je suis en master d'informatique à Paris Cité
|
|
||||||
(anciennement Paris 7), c'est marrant on fait de l'OCaml 🤓☝️.
|
|
||||||
</p>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<article id="friends">
|
|
||||||
<h1>Personnes incroyables</h1>
|
|
||||||
<a
|
|
||||||
href="https://github.com/2-1-1-2"
|
|
||||||
title="GitHub de 21_12"
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
><img src="/badges/friends/21_12.webp" alt="21_12" loading="lazy"
|
|
||||||
/></a>
|
|
||||||
|
|
||||||
<a
|
|
||||||
href="https://twitter.com/azazouille_"
|
|
||||||
title="Twitter de Azazouille"
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
><img
|
|
||||||
src="/badges/friends/azazouille.webp"
|
|
||||||
alt="Azazouille"
|
|
||||||
loading="lazy"
|
|
||||||
/></a>
|
|
||||||
|
|
||||||
<a
|
|
||||||
href="https://102jjwy.carrd.co/"
|
|
||||||
title="Carrd de 102jjwy"
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
><img src="/badges/friends/102jjwy.webp" alt="102jjwy" loading="lazy"
|
|
||||||
/></a>
|
|
||||||
|
|
||||||
<a
|
|
||||||
href="https://twitter.com/archivesmilfs"
|
|
||||||
title="Compte twitter favori de jas"
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
><img src="/badges/friends/jas.webp" alt="jas" loading="lazy"
|
|
||||||
/></a>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
{{/data}}
|
|
||||||
</main>
|
</main>
|
||||||
<script src="/js/index.js"></script>
|
<script src="/js/index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in a new issue