From 1d3ad68adae42f05ddd68c1b5183a8db5f2be338 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Tue, 25 Oct 2022 09:20:15 +0300 Subject: Add support for extra optional fields --- README.md | 15 ++++++++--- build.py | 5 ++-- names/yuval.yml | 4 ++- templates/index.html | 72 +++++++++++++++++++++++++++------------------------- 4 files changed, 56 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 4447658..d52c08a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # namehack.club -An exclusive club of nerds. +An exclusive club of nerds that own the domain hack to their name. ## Criteria @@ -11,10 +11,19 @@ An exclusive club of nerds. Open a new pull request to this repository that adds a new YAML file to the [`names`](names) directory. -If your domain name is `examp.le` the file name should be `example.yml`, and should include the following required fields: +If your domain name is `examp.le` the file name should be `example.yml`, and the following minimal fields are required: ```yaml domain: examp.le name: Example Foo +``` + +Other optional fields are supported: + +```yaml +domain: examp.le +name: Example Foo +url: https://examp.le/about/ # use to specify homepage URL, defaults to https://examp.le +title: UI/UX designer # maximum 80 chars email: hi@examp.le -``` \ No newline at end of file +``` diff --git a/build.py b/build.py index f6cba01..8649c73 100644 --- a/build.py +++ b/build.py @@ -11,7 +11,7 @@ NAMES_DIR = ROOT_PATH / "names" BUILD_DIR = ROOT_PATH / "build" STATIC_DIR = ROOT_PATH / "static" -REQUIRED_FIELDS = set(["domain", "name", "email"]) +REQUIRED_FIELDS = set(["domain", "name"]) TEMPLATES = ["index.html"] @@ -29,6 +29,7 @@ for name in listdir(NAMES_DIR): missing_fields = REQUIRED_FIELDS - set(fields.keys()) if missing_fields: raise Exception(f"Missing required fields {missing_fields} in {name}") + names.append(fields) # render templates @@ -40,4 +41,4 @@ for template in TEMPLATES: t = env.get_template(template) index = t.render(names=names) with open(BUILD_DIR / "index.html", "w") as f: - f.write(index) \ No newline at end of file + f.write(index) diff --git a/names/yuval.yml b/names/yuval.yml index 811fc7a..22f77d8 100644 --- a/names/yuval.yml +++ b/names/yuval.yml @@ -1,3 +1,5 @@ domain: yuv.al name: Yuval Adam -email: hello@yuv.al \ No newline at end of file +email: hello@yuv.al +title: Full-stack technologist, creator of namehack.club +# url: https://foo.goo diff --git a/templates/index.html b/templates/index.html index ce0ff0e..d080c40 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,36 +1,40 @@ - - - - namehack.club - - - - - - - - - - - - - - - - -

Domain Name Hack Club

-

An exclusive club of nerds that own the domain hack to their name, and serve their personal homepage from it.

- - -
-
- - \ No newline at end of file + + + + + namehack.club + + + + + + + + + + + + + + + + +

Domain Name Hack Club

+

An exclusive club of nerds that own the domain + hack to their name, and serve their personal homepage from it.

+ + +
+
+ + + -- cgit v1.3.1