Skip to content

Commit 7800f75

Browse files
committed
Merge branch 'refs/heads/main' into feature/update-logo
2 parents 908ad4e + 6ceae0a commit 7800f75

File tree

11 files changed

+183
-105
lines changed

11 files changed

+183
-105
lines changed

.github/workflows/deploy-pr.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
on:
2+
pull_request:
3+
types: [opened, edited, reopened, synchronize]
4+
5+
jobs:
6+
build_css:
7+
runs-on: ubuntu-latest
8+
env:
9+
source: public/dist/assets
10+
destination: assets/website-2021-dev/pr-${{ github.event.number }}/
11+
steps:
12+
- name: Checkout source Git branch
13+
uses: actions/checkout@v2
14+
with:
15+
ref: ${{github.event.pull_request.head.ref}}
16+
persist-credentials: false
17+
18+
- name: Use Node.js
19+
uses: actions/setup-node@v2
20+
with:
21+
node-version: '16'
22+
23+
- name: Install npm modules
24+
run: npm install
25+
26+
- name: compile assets
27+
run: npm run build
28+
29+
- name: Upload to cdn-dev.w3.org bucket
30+
if: success()
31+
env:
32+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
33+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
34+
AWS_REGION: 'us-east-1'
35+
run:
36+
aws s3 sync --no-progress ${{ env.source }} s3://cdn-dev.w3.org/${{ env.destination }}

.github/workflows/pr-closed.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
on:
2+
pull_request:
3+
types:
4+
- closed
5+
6+
jobs:
7+
delete_assets:
8+
runs-on: ubuntu-latest
9+
env:
10+
destination: assets/website-2021-dev/pr-${{ github.event.number }}/
11+
steps:
12+
- name: Delete PR assets from the cdn-dev.w3.org bucket
13+
if: success()
14+
env:
15+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
16+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
17+
AWS_REGION: 'us-east-1'
18+
run:
19+
aws s3 rm --recursive s3://cdn-dev.w3.org/${{ env.destination }}

composer.lock

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
set('http_user', 'apache');
2727
set('keep_releases', 10);
2828

29-
// Default stage - prevents accidental deploying to production with dep deploy
30-
set('default_selector', 'stage=staging');
31-
3229
// Directory that contains built website files
3330
set("build_folder", "_dist");
3431

src/Extensions/Twig/GetFromFrontendExtension.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ public function getFunctions(): array
2929
{
3030
return [
3131
new TwigFunction('global_nav', [$this, 'globalNav']),
32-
new TwigFunction('lang_nav', [$this, 'langNav'])
32+
new TwigFunction('lang_nav', [$this, 'langNav']),
33+
new TwigFunction('footer', [$this, 'footer']),
34+
new TwigFunction('common-head', [$this, 'commonHead'])
3335
];
3436
}
3537

@@ -56,12 +58,22 @@ private function fromFrontend(string $path): string
5658

5759
public function globalNav(): string
5860
{
59-
return $this->fromFrontend('/global-nav/');
61+
return $this->fromFrontend('/_fragments/global-nav/');
6062
}
6163

6264
public function langNav(): string
6365
{
64-
return $this->fromFrontend('/lang-nav/');
66+
return $this->fromFrontend('/_fragments/lang-nav/');
67+
}
68+
69+
public function footer(): string
70+
{
71+
return $this->fromFrontend('/_fragments/footer/');
72+
}
73+
74+
public function commonHead(): string
75+
{
76+
return $this->fromFrontend('/_fragments/common-head/');
6577
}
6678
}
6779

templates/_common-head.html.twig

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<meta charset="utf-8"/>
2+
<meta name="viewport" content="width=device-width, initial-scale=1">
3+
4+
<link rel="home" href="https://www.w3.org/"/>
5+
<link rel="icon" type="image/png" href="https://www.w3.org/assets/logos/w3c/favicon-32.png"/>
6+
<link rel="apple-touch-icon" type="image/png" href="https://www.w3.org/assets/logos/w3c/favicon-180.png"/>
7+
8+
<link rel="stylesheet" href="{{ absolute_url(asset('styles/core.css?ver=1.4', 'website-2021')) }}" media="screen"/>
9+
10+
<!--
11+
CSS Mustard Cut
12+
Print (Edge doesn't apply to print otherwise)
13+
Edge, Chrome 39+, Opera 26+, Safari 9+, iOS 9+, Android ~5+, Android UCBrowser ~11.8+
14+
FF 47+
15+
-->
16+
<link rel="stylesheet" id="advanced-stylesheet"
17+
href="{{ absolute_url(asset('styles/advanced.css?ver=1.4', 'website-2021')) }}" media="
18+
only print,
19+
only all and (pointer: fine), only all and (pointer: coarse), only all and (pointer: none),
20+
only all and (min--moz-device-pixel-ratio:0) and (display-mode:browser), (min--moz-device-pixel-ratio:0) and (display-mode:fullscreen)
21+
">
22+
<link rel="stylesheet" href="{{ absolute_url(asset('styles/print.css', 'website-2021')) }}" media="print"/>
23+
24+
<script src="{{ absolute_url(asset('js/libraries/fontfaceobserver.js', 'website-2021')) }}"></script>
25+
26+
<script>
27+
var myFont = new FontFaceObserver('Noto Sans');
28+
29+
Promise.all([myFont.load()]).then(function () {
30+
document.documentElement.className += " fonts-loaded";
31+
});
32+
33+
(function () {
34+
var linkEl = document.getElementById('advanced-stylesheet');
35+
if (window.matchMedia && window.matchMedia(linkEl.media).matches) {
36+
var script = document.createElement('script');
37+
script.src = '{{ absolute_url(asset('js/main.js?ver=1.4', 'website-2021')) }}';
38+
script.defer = true;
39+
document.querySelector('head').appendChild(script);
40+
(function (H) {
41+
H.className = H.className.replace(/\bno-js\b/, 'js')
42+
})(document.documentElement);
43+
}
44+
})();
45+
</script>

templates/base.html.twig

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
{%- endblock -%}
4545
</title>
4646

47-
<meta charset="utf-8"/>
48-
<meta name="viewport" content="width=device-width, initial-scale=1">
47+
{{~ include('@W3CWebsiteTemplates/_common-head.html.twig') }}
48+
4949
<meta name="description" content="{% block description %}{{ page.excerpt|default('page.default_description'|trans({}, 'w3c_website_templates_bundle')) }}{% endblock %}"/>
5050
<meta name="thumbnail" content="{{ thumbnail }}"/>
5151
{# <meta property="fb:app_id" content="__hardcoded_fb_app_id__"> #}
@@ -72,50 +72,10 @@
7272
{%- if page.expiryDate is defined and page.expiryDate -%}
7373
<meta name="robots" content="unavailable_after: {{ page.expiryDate }}"/>
7474
{% endif %}
75-
<link rel="home" href="https://www.w3.org/"/>
76-
77-
{% block stylesheets %}
78-
<link rel="stylesheet" href="{{ asset('styles/core.css?ver=1.4', 'website-2021') }}" media="screen"/>
79-
80-
<!--
81-
CSS Mustard Cut
82-
Print (Edge doesn't apply to print otherwise)
83-
Edge, Chrome 39+, Opera 26+, Safari 9+, iOS 9+, Android ~5+, Android UCBrowser ~11.8+
84-
FF 47+
85-
-->
86-
<link rel="stylesheet" id="advanced-stylesheet"
87-
href="{{ asset('styles/advanced.css?ver=1.4', 'website-2021') }}" media="
88-
only print,
89-
only all and (pointer: fine), only all and (pointer: coarse), only all and (pointer: none),
90-
only all and (min--moz-device-pixel-ratio:0) and (display-mode:browser), (min--moz-device-pixel-ratio:0) and (display-mode:fullscreen)
91-
">
92-
<link rel="stylesheet" href="{{ asset('styles/print.css', 'website-2021') }}" media="print"/>
93-
{% endblock stylesheets %}
94-
95-
{% block javascripts %}
96-
<script src="{{ asset('js/libraries/fontfaceobserver.js', 'website-2021') }}"></script>
97-
98-
<script>
99-
var myFont = new FontFaceObserver('Noto Sans');
10075

101-
Promise.all([myFont.load()]).then(function () {
102-
document.documentElement.className += " fonts-loaded";
103-
});
76+
{% block stylesheets %}{% endblock stylesheets %}
10477

105-
(function () {
106-
var linkEl = document.getElementById('advanced-stylesheet');
107-
if (window.matchMedia && window.matchMedia(linkEl.media).matches) {
108-
var script = document.createElement('script');
109-
script.src = '{{ asset('js/main.js?ver=1.4', 'website-2021') }}';
110-
script.defer = true;
111-
document.querySelector('head').appendChild(script);
112-
(function (H) {
113-
H.className = H.className.replace(/\bno-js\b/, 'js')
114-
})(document.documentElement);
115-
}
116-
})();
117-
</script>
118-
{% endblock javascripts %}
78+
{% block javascripts %}{% endblock javascripts %}
11979

12080
{% if page.feeds is defined %}
12181
{% for feed in page.feeds %}

templates/components/styles/footer.html.twig

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% if links is empty %}
1+
{% if links is not defined or links is empty -%}
22
{% set links = [
33
{
44
'copy': 'footer.links.home'|trans({}, 'w3c_website_templates_bundle'),
@@ -35,25 +35,27 @@
3535
<div class="global-footer__links">
3636
<div class="l-cluster">
3737
<ul class="clean-list" role="list">
38-
{% for link in links %}
39-
<li>
38+
{%~ for link in links %}
39+
<li>{# -#}
4040
<a href="{{ link.url }}" hreflang="{{ 'footer.links.hreflang'|trans({}, 'w3c_website_templates_bundle') }}">
41-
{{ link.copy|raw }}
42-
</a>
41+
{{- link.copy|raw -}}
42+
</a>{# -#}
4343
</li>
44-
{% endfor %}
44+
{%~ endfor %}
4545
</ul>
4646
</div>
4747
<ul class="clean-list" role="list">
48-
<li><a class="with-icon--larger" href="https://w3c.social/@w3c" hreflang="en">
49-
<img class="icon icon--larger" src="{{ asset('svg/mastodon.svg', 'website-2021') }}" width="20"
50-
height="20" alt aria-hidden="true" loading="lazy"/>
51-
<span class="visuallyhidden">{{ 'footer.links.mastodon'|trans({}, 'w3c_website_templates_bundle')|raw }}</span></a>
48+
<li>
49+
<a class="with-icon--larger" href="https://w3c.social/@w3c" hreflang="en">
50+
<img class="icon icon--larger" src="{{ absolute_url(asset('svg/mastodon.svg', 'website-2021')) }}" width="20" height="20" alt aria-hidden="true" loading="lazy"/>
51+
<span class="visuallyhidden">{{ 'footer.links.mastodon'|trans({}, 'w3c_website_templates_bundle')|raw }}</span>
52+
</a>
5253
</li>
53-
<li><a class="with-icon--larger" href="https://github.com/w3c/" hreflang="en">
54-
<img class="icon icon--larger" src="{{ asset('svg/github.svg', 'website-2021') }}" width="20"
55-
height="20" alt aria-hidden="true" loading="lazy"/>
56-
<span class="visuallyhidden">{{ 'footer.links.github'|trans({}, 'w3c_website_templates_bundle')|raw }}</span></a>
54+
<li>
55+
<a class="with-icon--larger" href="https://github.com/w3c/" hreflang="en">
56+
<img class="icon icon--larger" src="{{ absolute_url(asset('svg/github.svg', 'website-2021')) }}" width="20" height="20" alt aria-hidden="true" loading="lazy"/>
57+
<span class="visuallyhidden">{{ 'footer.links.github'|trans({}, 'w3c_website_templates_bundle')|raw }}</span>
58+
</a>
5759
</li>
5860
</ul>
5961
</div>

templates/components/styles/global_nav.html.twig

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,46 @@
99
<button type="button" class="button button--ghost with-icon--after with-icon--larger" data-trigger="mobile-nav"
1010
style="display: none;"></button>
1111
<ul data-component="nav-double-intro">
12-
{% for navItem in navigation %}
12+
{%~ for navItem in navigation %}
1313
<li class="top-nav-item has-children">
1414
<a href="{{ navItem.titleLink }}" class="nav-link">{{ navItem.title }}</a>
1515
<div class="nav__submenu" data-nav="submenu" style="display: none;">
1616
<div class="l-center">
1717
<div class="nav__submenu__intro">
1818
<h2 class="nav__submenu__intro__heading">{{ navItem.title }}</h2>
1919
<div class="nav__submenu__intro__text">
20-
{% if navItem.introText is defined and navItem.introText %}
20+
{%~ if navItem.introText is defined and navItem.introText %}
2121
<p>{{ navItem.introText }}</p>
22-
{% endif %}
23-
{% for introLink in navItem.introLinks %}
22+
{%~ endif %}
23+
{%~ for introLink in navItem.introLinks %}
2424
<a href="{{ introLink.url }}">{{ introLink.title }}</a>
25-
{% endfor %}
25+
{%~ endfor %}
2626
</div>
2727
</div>
28-
{% if navItem.children is defined and navItem.children|length > 0 %}
28+
{% if navItem.children is defined and navItem.children|length > 0 -%}
2929
<ul>
30-
{% for child in navItem.children %}
31-
<li {{ child.startNewColumn is defined and child.startNewColumn ? 'class="break-after"' : '' }}>
32-
<a href="{{ child.url }}">{{ child.title }}</a>
30+
{%~ for child in navItem.children %}
31+
<li{{ child.startNewColumn is defined and child.startNewColumn ? ' class="break-after"' : '' }}>{# -#}
32+
<a href="{{ child.url }}">{{ child.title }}</a>{# -#}
3333
</li>
34-
{% endfor %}
34+
{%~ endfor %}
3535
</ul>
36-
{% endif %}
36+
{%~ endif %}
3737
</div>
3838
</div>
3939
</li>
40-
{% endfor %}
40+
{%~ endfor %}
4141
<li class="top-nav-item">
4242
<a hreflang="en" href="https://www.w3.org/help/search/" class="nav-link icon-link">
43-
<img class="icon" src="{{ absolute_url(asset('svg/search.svg', 'website-2021')) }}" width="24" height="24" alt aria-hidden="true"><span class="hide-at-max-width">{{ 'header.search_link'|trans({}, 'w3c_website_templates_bundle') }}</span>
43+
<img class="icon" src="{{ absolute_url(asset('svg/search.svg', 'website-2021')) }}" width="24" height="24" alt aria-hidden="true">{# -#}
44+
<span class="hide-at-max-width">{{ 'header.search_link'|trans({}, 'w3c_website_templates_bundle') }}</span>
4445
</a>
4546
</li>
4647
<li class="top-nav-item">
4748
<a hreflang="en" href="https://www.w3.org/users/myprofile/" id="account-login-link" class="account-login icon-link with-icon--after">
48-
{{ 'header.account_link'|trans({}, 'w3c_website_templates_bundle') }} <span class="avatar avatar--small icon">
49-
<img src="{{ absolute_url(asset('svg/avatar.svg', 'website-2021')) }}" width="24" height="24" alt aria-hidden="true"/>
49+
{{ 'header.account_link'|trans({}, 'w3c_website_templates_bundle') }}
50+
<span class="avatar avatar--small icon">{# -#}
51+
<img src="{{ absolute_url(asset('svg/avatar.svg', 'website-2021')) }}" width="24" height="24" alt aria-hidden="true"/>{# -#}
5052
</span>
5153
</a>
5254
</li>

0 commit comments

Comments
 (0)