Skip to content

Commit 281324a

Browse files
Mohit Khandelwalfarhaanbukhsh
authored andcommitted
Add: extend the common page layout with capability to change the top iconset
Issue: #146 Other Changes: - Update start development server command in readme.md
1 parent bbb9d2f commit 281324a

File tree

6 files changed

+355
-3
lines changed

6 files changed

+355
-3
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This repository contains the source code for the PyCon India 2025 website, built
2424

2525
3. Start the development server:
2626
```sh
27-
npm run serve
27+
make deploy-dev-server
2828
```
2929

3030
4. Open your browser and visit `http://localhost:8080`
@@ -103,6 +103,27 @@ We use a component-based approach with Nunjucks templates:
103103
{{ componentName("value1", "value2") }}
104104
```
105105

106+
#### Custom Icons for Page Layouts
107+
108+
You can add icons to your page by specifying an `iconset` key in the frontmatter.
109+
110+
Only one iconset is allowed per page. Each iconset maps to one or more images based on a predefined list in the layout.
111+
112+
```markdown
113+
---
114+
title: Contact Us
115+
description: |
116+
PyCon India 2025 is a purely volunteer community conference, driven by people passionate about Python.
117+
layout: page.njk
118+
iconset: question
119+
---
120+
```
121+
This will display the "Question Mark" icon near the top of the page.
122+
123+
If you want to use a new combination of icons, you must:
124+
1. Add the new iconset and its image mapping to the [src/_data/icon_map.json](https://github.com/pythonindia/inpycon2025/blob/main/src/_data_/icon_map.json).
125+
2. Use the new key in your page frontmatter.
126+
106127
### 5. Styling Guidelines
107128

108129
We use Tailwind CSS for styling:

src/_data/icon_map.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"announce": [{ "src": "img/assets/announce.svg", "alt": "Announcement" }],
3+
"bulb": [{ "src": "img/assets/bulb.svg", "alt": "Lightbulb for ideas" }],
4+
"calendar": [{ "src": "img/assets/calendar.svg", "alt": "Calendar" }],
5+
"checklist": [{ "src": "img/assets/notepad.svg", "alt": "Checklist" }],
6+
"childcare": [{ "src": "img/assets/child-care.svg", "alt": "Child playing with mother" }],
7+
"coffee": [{ "src": "img/assets/filter-coffee.svg", "alt": "Filter Coffee" }],
8+
"laptop": [{ "src": "img/assets/laptop.svg", "alt": "Laptop" }],
9+
"question": [{ "src": "img/assets/question-mark.svg", "alt": "Question mark" }],
10+
"spacecraft": [{ "src": "img/assets/spacecraft.svg", "alt": "Spacecraft" }],
11+
"sponsors": [{ "src": "img/assets/sponsors.svg", "alt": "Partnership" }],
12+
"team": [{ "src": "img/assets/team.svg", "alt": "Team members" }],
13+
"laptop-coffee": [
14+
{ "src": "img/assets/laptop.svg", "alt": "Laptop" },
15+
{ "src": "img/assets/filter-coffee.svg", "alt": "Filter Coffee" }
16+
]
17+
}

src/_layouts/page.njk

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ layout: base.njk
1010

1111
{% from "components/button.njk" import button %}
1212

13+
{% set icons = icon_map[iconset] or icon_map["laptop-coffee"] %}
14+
15+
1316
<div class="w-full h-auto bg-pycon-blue -mb-24 px-[6%] flex flex-col md:flex-row">
1417
<div class="pt-32 pb-8 md:pb-32 w-full lg:w-[70%]">
1518
<div class="black-han-sans-regular font-normal text-3xl md:text-5xl md:text-center text-[#FFFFFF] text-center lg:text-left">
@@ -20,8 +23,14 @@ layout: base.njk
2023
</div>
2124
</div>
2225
<div class="lg:w-[30%] w-[80%] lg:mt-60 flex items-center justify-center mx-auto">
23-
<img src="{{ env.baseUrl }}img/assets/laptop.svg" alt="Guide" class="w-[40%] lg:w-[60%] transition-transform duration-100" style="animation: floating 2s ease-in-out infinite;">
24-
<img src="{{ env.baseUrl }}img/assets/filter-coffee.svg" alt="Guide" class="w-[40%] lg:w-[60%] transition-transform duration-100" style="animation: floating 2s ease-in-out infinite;">
26+
{% for icon in icons %}
27+
<img
28+
src="{{ env.baseUrl ~ icon.src }}"
29+
alt="{{ icon.alt or icon.src | filenameToAlt }}"
30+
class="w-[40%] lg:w-[60%] transition-transform duration-100"
31+
style="animation: floating 2s ease-in-out infinite;"
32+
>
33+
{% endfor %}
2534
</div>
2635
</div>
2736

0 commit comments

Comments
 (0)