Skip to content

Commit 588d898

Browse files
committed
Update Twig templates
1 parent a2440c0 commit 588d898

File tree

7 files changed

+56
-45
lines changed

7 files changed

+56
-45
lines changed

src/data/common.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,24 @@
33
"title": "BINABOX",
44
"discordUrl": "#",
55
"menu": [
6-
{ "label": "Home", "url": "index.html", "active": true },
7-
{ "label": "Blog", "url": "blog.html", "active": false },
8-
{ "label": "Catalog", "url": "catalog.html", "active": false },
9-
{ "label": "About", "url": "about.html", "active": false },
10-
{ "label": "Contact", "url": "contact.html", "active": false }
6+
{ "label": "Home", "url": "index.twig", "active": true },
7+
{ "label": "Blog", "url": "blog.twig", "active": false },
8+
{ "label": "Catalog", "url": "catalog.twig", "active": false },
9+
{ "label": "About", "url": "about.twig", "active": false },
10+
{ "label": "Contact", "url": "contact.twig", "active": false }
1111
]
1212
},
1313
"footer": {
1414
"description": "We are the best way to check the rarity of NFT collections.",
1515
"menu": [
16-
{ "label": "Home", "url": "index.html" },
17-
{ "label": "Blog", "url": "blog.html" },
18-
{ "label": "Catalog", "url": "catalog.html" },
19-
{ "label": "Contact", "url": "contact.html" }
16+
{ "label": "Home", "url": "index.twig" },
17+
{ "label": "Blog", "url": "blog.twig" },
18+
{ "label": "Catalog", "url": "catalog.twig" },
19+
{ "label": "Contact", "url": "contact.twig" }
2020
],
2121
"social": [
2222
{ "name": "Twitter", "url": "https://twitter.com" },
2323
{ "name": "Discord", "url": "https://discord.com" }
2424
]
2525
}
2626
}
27-

src/pages/blog.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "src/templates/layouts/base.twig" %}
1+
{% extends "templates/layouts/base.twig" %}
22

33
{% block title %}BINABOX Blog Page{% endblock %}
44

src/pages/index.twig

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
{% extends "src/templates/layouts/base.twig" %}
1+
{% extends "templates/layouts/base.twig" %}
2+
23

34

45
{% block content %}
@@ -22,7 +23,9 @@
2223
<button class="banner__button banner__button--disable">Whitelist now</button>
2324
</div>
2425

25-
<img src="{{ page.banner_image }}" class="banner__image" alt="Banner Image">
26+
<img src="{{ page.banner_image }}" class="banner__image" alt="Banner Image">
27+
28+
2629
</section>
2730

2831
<!-- ============== CATALOG ============== -->
@@ -36,7 +39,8 @@
3639
{% for product in page.catalog_products %}
3740
<li class="catalog__item">
3841
<article class="catalog__product">
39-
<img src="{{ product.image }}" class="catalog__image" alt="{{ product.title }}">
42+
<img src="{{ product.image }}" class="catalog__image" alt="{{ product.title }}">
43+
4044
{% if product.badge %}
4145
<span class="catalog__badge">{{ product.badge }}</span>
4246
{% endif %}
@@ -54,6 +58,7 @@
5458
{% for post in page.blog_posts %}
5559
<article class="blog__post">
5660
<img src="{{ post.image }}" class="blog__image" alt="{{ post.title }}">
61+
5762
<div class="blog__meta">
5863
<span class="blog__subtitle">{{ post.author }}</span> |
5964
<span class="blog__date">{{ post.date }}</span>
@@ -85,7 +90,8 @@
8590
<h2 class="team__title">Our Team</h2>
8691
{% for member in page.team_members %}
8792
<div class="team__card">
88-
<img src="{{ member.image }}" alt="{{ member.name }}" class="team__image">
93+
<img src="{{ member.image }}" alt="{{ member.name }}" class="team__image">
94+
8995
<h3 class="team__name">{{ member.name }}</h3>
9096
<p class="team__role">{{ member.role }}</p>
9197
<ul class="team__social">

src/templates/layouts/base.twig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,24 @@
99
<link href="https://fonts.googleapis.com/css2?family=Bakbak+One&family=Black+Han+Sans&family=Candal&family=Lalezar&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
1010
<link href="https://fonts.googleapis.com/css2?family=Bakbak+One&family=Black+Han+Sans&family=Candal&family=Lalezar&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
1111

12-
<link rel="stylesheet" href="{{ asset('src/styles/style.css') }}">
12+
<link rel="stylesheet" href="/src/styles/style.css">
13+
1314

1415

1516
{% block head %}{% endblock %}
1617
</head>
1718
<body>
1819
{# Header block (default includes header partial) #}
1920
{% block header %}
20-
{% include "partials/header.twig" %}
21+
{% include "../partials/header.twig" %}
2122
{% endblock %}
2223

2324
{# Main content block #}
2425
{% block content %}{% endblock %}
2526

2627
{# Footer block (default includes footer partial) #}
2728
{% block footer %}
28-
{% include "partials/footer.twig" %}
29+
{% include "../partials/footer.twig" %}
2930
{% endblock %}
3031

3132

src/templates/partials/footer.twig

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
1-
<nav class="main-nav">
2-
<div class="container">
3-
<!-- Logo -->
4-
<a href="index.html" class="logo">
5-
<img src="/src/assets/images/logo.svg" alt="BINABOX Logo">
6-
</a>
1+
<footer class="site-footer">
2+
<div class="container">
73

8-
<!-- Navigation Menu -->
9-
<ul class="nav-menu">
10-
{% for item in common.site.menu %}
11-
<li class="nav-item {% if item.active %}active{% endif %}">
12-
<a href="{{ item.url }}" class="nav-link">{{ item.label }}</a>
13-
</li>
14-
{% endfor %}
15-
</ul>
4+
<!-- Footer Description -->
5+
<p class="footer-description">{{ common.footer.description }}</p>
166

17-
<!-- Social Links -->
18-
<div class="nav-social">
19-
{% for social in common.footer.social %}
20-
<a href="{{ social.url }}" class="social-link" target="_blank" rel="noopener">{{ social.name }}</a>
21-
{% endfor %}
22-
</div>
7+
<!-- Footer Menu -->
8+
<ul class="footer-menu">
9+
{% for item in common.footer.menu %}
10+
<li class="footer-menu-item">
11+
<a href="{{ item.url }}" class="footer-link">{{ item.label }}</a>
12+
</li>
13+
{% endfor %}
14+
</ul>
2315

24-
<!-- Discord / Action Button -->
25-
<a href="{{ common.site.discordUrl }}" class="btn btn-discord">Join Discord</a>
16+
<!-- Social Links -->
17+
<div class="footer-social">
18+
{% for social in common.footer.social %}
19+
<a href="{{ social.url }}" class="social-link" target="_blank" rel="noopener">{{ social.name }}</a>
20+
{% endfor %}
2621
</div>
27-
</nav>
22+
23+
</div>
24+
</footer>

src/templates/partials/header.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<!-- Logo -->
44
<a href="index.html" class="logo">
55
<img src="/src/assets/images/logo.svg" alt="BINABOX Logo">
6+
67
</a>
78

89
<!-- Navigation Menu -->

vite.config.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { defineConfig } from 'vite';
22
import fs from 'fs';
33
import path from 'path';
4+
import vituum from 'vituum'
45
import twig from '@vituum/vite-plugin-twig';
56
import nunjucks from '@vituum/vite-plugin-nunjucks';
67
import postcss from '@vituum/vite-plugin-postcss';
@@ -12,6 +13,10 @@ const commonData = JSON.parse(
1213
fs.readFileSync(path.resolve('src/data/common.json'), 'utf-8')
1314
);
1415

16+
const indexData = JSON.parse(
17+
fs.readFileSync(path.resolve('src/data/index.json'), 'utf-8')
18+
);
19+
1520
export default defineConfig({
1621
server: {
1722
port: 5173,
@@ -23,15 +28,17 @@ export default defineConfig({
2328
},
2429
plugins: [
2530
svgSprite(),
31+
vituum(),
2632
twig({
2733
root: 'src', // Root folder for Twig templates
2834
templatesDir: [
29-
'src/pages', // your page templates
30-
'src/templates/layouts', // layouts like base.twig
31-
'src/templates/partials' // header/footer partials
35+
'pages', // your page templates
36+
'templates/layouts', // layouts like base.twig
37+
'templates/partials' // header/footer partials
3238
],
3339
globals: {
34-
common: commonData
40+
common: commonData,
41+
page: indexData
3542
}
3643
}),
3744
nunjucks(),

0 commit comments

Comments
 (0)