Template website

This commit is contained in:
Julien Marquet 2024-01-31 16:20:02 +01:00
commit cc965423db
12 changed files with 220 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
dist-newstyle
_cache
_site
result

31
Main.hs Normal file
View File

@ -0,0 +1,31 @@
{-# LANGUAGE OverloadedStrings #-}
import qualified GHC.IO.Encoding as E
import Data.Monoid (mappend)
import Hakyll
main :: IO ()
main = do
E.setLocaleEncoding E.utf8
hakyll $ do
match "assets/css/*" $ do
route idRoute
compile compressCssCompiler
match "assets/images/*" $ do
route idRoute
compile copyFileCompiler
{-match "index.md" $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "layouts/default.html" defaultContext
>>= relativizeUrls-}
match "index.html" $ do
route $ idRoute
compile $ getResourceBody
>>= relativizeUrls
match "layouts/*" $ compile templateBodyCompiler

68
assets/css/style.css Normal file
View File

@ -0,0 +1,68 @@
body {
margin: 40px auto;
max-width: 650px;
font-size: 18px;
padding: 0 10px;
}
ul {
margin: 0;
}
.pic {
float: right;
width: 200px;
}
.pic-small {
float: right;
width: 80px;
display: none;
}
.lightbox {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
padding: 1em;
backdrop-filter: blur(2px);
visibility: hidden;
opacity: 0;
transition: visibility 0s, opacity 0.2s linear;
}
.lightbox:target {
visibility: visible;
opacity: 1;
}
.lightbox span {
display: block;
width: 100%;
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: contain;
}
@media (max-width: 650px) {
body {
font-size: 14px;
}
.pic {
display: none;
}
.pic-small {
display: block;
}
}
.headpar {
margin: 18px 0;
}

BIN
assets/images/pic.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 KiB

17
default.nix Normal file
View File

@ -0,0 +1,17 @@
{ pkgs ? import <nixpkgs> {} }:
let
#ssg = pkgs.haskellPackages.callPackage ./simiweb.nix {};
src = pkgs.nix-gitignore.gitignoreSource [] ./.;
ssg = pkgs.haskellPackages.callCabal2nix "simiweb" src {};
in {
site = pkgs.stdenv.mkDerivation {
name = "simiweb";
src = pkgs.nix-gitignore.gitignoreSource [] ./.;
buildPhase = ''
${ssg}/bin/ssg build
'';
installPhase = ''
mv _site $out
'';
};
}

32
index.html Normal file
View File

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" type="text/css" href="/assets/css/style.css">
</head>
<body>
<div>
<img class="pic" src="/assets/images/pic.jpg">
<a href="#lightbox"><img class="pic-small" src="/assets/images/pic_square.jpg"></a>
<a href="#" class="lightbox" id="lightbox">
<span style="background-image: url('/assets/images/pic.jpg')"></span>
</a>
<h2>Sessions Informelles Maths-Info</h2>
<div class="headpar">
Organisées à l'École Normale Supérieure - PSL
</div>
<div class="headpar">
Notre but est de&nbsp;:
<ul>
<li>Faire des présentations intéressantes</li>
<li>Passer un bon moment <em>et</em> manger</li>
</ul>
</div>
<div class="headpar">
On aime bien les panthères, la photo vient
d'<a href="https://www.pexels.com/photo/white-tiger-resting-on-rough-land-near-pond-in-zoo-5810713/">ici</a>.
</div>
</div>
</body>
</html>

10
layouts/default.html Normal file
View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="/assets/css/style.css">
</head>
<body>
$body$
</body>
</html>

13
shell.nix Normal file
View File

@ -0,0 +1,13 @@
{ pkgs ? import <nixpkgs> {} }:
let
src = pkgs.nix-gitignore.gitignoreSource [] ./.;
in pkgs.haskellPackages.shellFor {
packages = hpkgs: [
(hpkgs.callCabal2nix "simiweb" src {})
];
nativeBuildInputs = [
pkgs.cabal-install
pkgs.cabal2nix
pkgs.haskell-language-server
];
}

14
simiweb.cabal Normal file
View File

@ -0,0 +1,14 @@
cabal-version: 1.12
name: simiweb
version: 0.0.0
build-type: Simple
executable ssg
main-is: Main.hs
other-modules:
Paths_simiweb
build-depends:
base
, hakyll
default-language: Haskell2010

11
simiweb.nix Normal file
View File

@ -0,0 +1,11 @@
{ mkDerivation, base, hakyll, lib }:
mkDerivation {
pname = "simiweb";
version = "0.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [ base hakyll ];
license = "unknown";
mainProgram = "ssg";
}

20
style.css Normal file
View File

@ -0,0 +1,20 @@
body {
margin: 40px auto;
max-width: 650px;
font-size: 18px;
padding: 0 10px;
}
ul {
margin: 0;
}
.pic {
float: right;
}
.headpar {
margin: 18px 0;
}