Skip to content

Commit 296d803

Browse files
committed
Dedicated news page.
News navigation is removed from the menu so the menu is consistent across every page. The news page itself now provides in-page navigation to current and previous years' news. The index (homepage) is replicated at /news.html as a precursor to it becoming a multi-purpose homepage.
1 parent 459dc20 commit 296d803

File tree

8 files changed

+150
-49
lines changed

8 files changed

+150
-49
lines changed

GNUmakefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ LANGS = en ru
7171

7272
YEARS = \
7373
2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 \
74-
2020 2021 2022 2023
74+
2020 2021 2022 2023 2024
7575

7676
all: news arx 404 css $(LANGS)
7777

78-
news: $(OUT)/index.html $(OUT)/index.rss
78+
news: $(OUT)/index.html $(OUT)/news.html $(OUT)/index.rss
7979
arx: $(foreach year,$(YEARS),$(OUT)/$(year).html)
8080
404: $(OUT)/404.html
8181
css: $(foreach f,$(wildcard css/*.css),$(OUT)/$(f))
@@ -141,6 +141,11 @@ $(OUT)/index.html: \
141141
$(NEWS_DEPS)
142142
$(call XSLT, xslt/news.xslt, $<, $@)
143143

144+
$(OUT)/news.html: \
145+
xml/index.xml \
146+
$(NEWS_DEPS)
147+
$(call XSLT, xslt/news.xslt, $<, $@)
148+
144149
$(OUT)/index.rss: \
145150
xml/index.xml \
146151
$(NEWS_DEPS) \

css/style_en.css

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,36 @@ table.donors li {
105105
text-align: left;
106106
}
107107

108+
/* News Archive button */
109+
.dropbtn {
110+
background-color: #808080;
111+
color: white;
112+
padding: 0.3rem;
113+
font-size: 1rem;
114+
border: 1px solid #606060;
115+
}
116+
.dropdown {
117+
position: relative;
118+
display: inline-block;
119+
padding-bottom: 0.5em;
120+
}
121+
.dropdown-content {
122+
display: none;
123+
position: absolute;
124+
background-color: #f0f0f0;
125+
min-width: 160px;
126+
box-shadow: 0px 8px 12px 0px #909090;
127+
z-index: 1;
128+
}
129+
.dropdown-content a {
130+
padding: 0.33em;
131+
text-decoration: none;
132+
display: block;
133+
}
134+
.dropdown-content a:hover {background-color: #a0a0a0;}
135+
.dropdown:hover .dropdown-content {display: block;}
136+
.dropdown:hover .dropbtn {background-color: #909090;}
137+
108138
div.directive {
109139
background: #F2F2F2;
110140
line-height: 1em;
@@ -419,4 +449,11 @@ sup {
419449
background:#0c1622;
420450
color: #ddd!important;
421451
}
452+
.dropbtn {background-color: #202020;}
453+
.dropdown-content {
454+
background-color: #404040;
455+
box-shadow: 0px 8px 12px 0px #101010;
456+
}
457+
.dropdown-content a:hover {background-color: #242424;}
458+
.dropdown:hover .dropbtn {background-color: #202020;}
422459
}

css/style_ru.css

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,36 @@ table.donors li {
105105
text-align: left;
106106
}
107107

108+
/* News Archive button */
109+
.dropbtn {
110+
background-color: #808080;
111+
color: white;
112+
padding: 0.3rem;
113+
font-size: 1rem;
114+
border: 1px solid #606060;
115+
}
116+
.dropdown {
117+
position: relative;
118+
display: inline-block;
119+
padding-bottom: 0.5em;
120+
}
121+
.dropdown-content {
122+
display: none;
123+
position: absolute;
124+
background-color: #f0f0f0;
125+
min-width: 160px;
126+
box-shadow: 0px 8px 12px 0px #909090;
127+
z-index: 1;
128+
}
129+
.dropdown-content a {
130+
padding: 0.33em;
131+
text-decoration: none;
132+
display: block;
133+
}
134+
.dropdown-content a:hover {background-color: #a0a0a0;}
135+
.dropdown:hover .dropdown-content {display: block;}
136+
.dropdown:hover .dropbtn {background-color: #909090;}
137+
108138
div.directive {
109139
background: #F2F2F2;
110140
line-height: 1em;
@@ -419,4 +449,11 @@ sup {
419449
background:#0c1622;
420450
color: #ddd!important;
421451
}
452+
.dropbtn {background-color: #202020;}
453+
.dropdown-content {
454+
background-color: #404040;
455+
box-shadow: 0px 8px 12px 0px #101010;
456+
}
457+
.dropdown-content a:hover {background-color: #242424;}
458+
.dropdown:hover .dropbtn {background-color: #202020;}
422459
}

dtd/news.dtd

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@
33
Copyright (C) Nginx, Inc.
44
-->
55

6-
<!ELEMENT news (event+) >
6+
<!ELEMENT news (event | years)+ >
7+
8+
<!ELEMENT years (year+) >
9+
10+
<!ELEMENT year (#PCDATA) >
11+
<!ATTLIST year
12+
href CDATA #IMPLIED
13+
year CDATA #IMPLIED
14+
>
15+
716
<!ATTLIST news
817
name CDATA #REQUIRED
918
link CDATA #REQUIRED

xml/index.xml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,26 @@
55

66
<!DOCTYPE news SYSTEM "../dtd/news.dtd">
77

8-
<news name="nginx news" link="/" lang="en">
8+
<news name="nginx news" link="/news.html" lang="en">
9+
10+
<years>
11+
<year href="2024.html" year="2024" />
12+
<year href="2023.html" year="2023" />
13+
<year href="2022.html" year="2022" />
14+
<year href="2021.html" year="2021" />
15+
<year href="2020.html" year="2020" />
16+
<year href="2019.html" year="2019" />
17+
<year href="2018.html" year="2018" />
18+
<year href="2017.html" year="2017" />
19+
<year href="2016.html" year="2016" />
20+
<year href="2015.html" year="2015" />
21+
<year href="2014.html" year="2014" />
22+
<year href="2013.html" year="2013" />
23+
<year href="2012.html" year="2012" />
24+
<year href="2011.html" year="2011" />
25+
<year href="2010.html" year="2010" />
26+
<year href="2009.html" year="2009" />
27+
</years>
928

1029
<event date="2024-10-02">
1130
<para>

xml/menu.xml

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<item />
2323
-->
2424

25-
<item href="/" lang="en"> 新闻 </item>
25+
<item href="/news.html" lang="en"> 新闻 </item>
2626
<item href="/cn/"> nginx 介绍 </item>
2727
<item href="/en/download.html" lang="en"> 下载 </item>
2828
<item href="/en/security_advisories.html" lang="en"> 安全漏洞 </item>
@@ -57,24 +57,7 @@
5757
<item />
5858
-->
5959

60-
<item href="/"> news </item>
61-
<item href="2023.html" year="2023" />
62-
<item href="2022.html" year="2022" />
63-
<item href="2021.html" year="2021" />
64-
<item href="2020.html" year="2020" />
65-
<item href="2019.html" year="2019" />
66-
<item href="2018.html" year="2018" />
67-
<item href="2017.html" year="2017" />
68-
<item href="2016.html" year="2016" />
69-
<item href="2015.html" year="2015" />
70-
<item href="2014.html" year="2014" />
71-
<item href="2013.html" year="2013" />
72-
<item href="2012.html" year="2012" />
73-
<item href="2011.html" year="2011" />
74-
<item href="2010.html" year="2010" />
75-
<item href="2009.html" year="2009" />
76-
<item year="" />
77-
60+
<item href="/news.html"> news </item>
7861
<item href="/en/"> about </item>
7962
<item href="/en/download.html"> download </item>
8063
<item href="/en/security_advisories.html"> security </item>
@@ -110,7 +93,7 @@
11093
<item />
11194
-->
11295

113-
<item href="/" lang="אנגלית"> חדשות </item>
96+
<item href="/news.html" lang="אנגלית"> חדשות </item>
11497
<item href="/he/"> אודות </item>
11598
<item href="/en/download.html" lang="אנגלית"> הורדה </item>
11699
<item href="/en/security_advisories.html" lang="אנגלית"> דיווחי אבטחה </item>
@@ -144,7 +127,7 @@
144127
<item />
145128
-->
146129

147-
<item href="/" lang="en"> ニュース </item>
130+
<item href="/news.html" lang="en"> ニュース </item>
148131
<item href="/ja/"> nginx について </item>
149132
<item href="/en/download.html" lang="en"> ダウンロード </item>
150133
<item href="/en/security_advisories.html" lang="en"> セキュリティ情報 </item>
@@ -179,7 +162,7 @@
179162
<item />
180163
-->
181164

182-
<item href="/" lang="en"> новости </item>
165+
<item href="/news.html" lang="en"> новости </item>
183166
<item href="/ru/"> об nginx </item>
184167
<item href="/ru/download.html"> скачать </item>
185168
<item href="/en/security_advisories.html" lang="en"> безопасность </item>
@@ -215,7 +198,7 @@
215198
<item />
216199
-->
217200

218-
<item href="/" lang="ing"> haberler </item>
201+
<item href="/news.html" lang="ing"> haberler </item>
219202
<item href="/tr/"> hakkında </item>
220203
<item href="/en/download.html" lang="ing"> indir </item>
221204
<item href="/en/security_advisories.html" lang="ing">

xsls/menu.xsls

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
X:stylesheet {
77

88
X:template = "menu/item" {
9-
109
<!--
1110
-- variables are not allowed in a template match predicate,
1211
-- therefore, we have to use ugly "if"s instead of elegant
@@ -16,11 +15,7 @@ X:template = "menu/item" {
1615
<li>
1716

1817
X:if "@href = $LINK" {
19-
X:if "$YEAR and @href='/'" {
20-
<a href="./"> news </a> <br/>
21-
} else {
22-
!{ normalize-space(text()) }<br/>
23-
}
18+
!{ normalize-space(text()) }<br/>
2419

2520
} else {
2621
<!--
@@ -72,19 +67,6 @@ X:template = "menu/item" {
7267
}
7368

7469

75-
X:template = "menu/item[@year]" {
76-
X:if "$YEAR or $LINK='/'" {
77-
<li>
78-
X:if "$YEAR=@year" {
79-
!{@year}
80-
} else {
81-
X:if "@href" { <a href="{@href}"> !{@year} </a> }
82-
}
83-
</li>
84-
}
85-
}
86-
87-
8870
X:template = "menu/item[starts-with(@href, 'http://') or starts-with(@href, 'https://')]" {
8971
<li>
9072
<a href="{@href}"> !{ normalize-space(text()) } </a>
@@ -93,7 +75,7 @@ X:template = "menu/item[starts-with(@href, 'http://') or starts-with(@href, 'htt
9375
}
9476

9577

96-
X:template = "menu/item[not(@href) and not(@year)]" {
78+
X:template = "menu/item[not(@href)]" {
9779
<li>!{ normalize-space(text()) } <br/></li>
9880
}
9981

xsls/news.xsls

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,48 @@ X:template = "/news" {
4747
</html>
4848
}
4949

50+
X:template = "years/year[@year]" {
51+
X:if "position() = 1" {
52+
X:text disable-output-escaping="yes" {
53+
&lt;div class="dropdown"&gt;
54+
&lt;button class="dropbtn"&gt;news archive ▾&lt;/button&gt;
55+
&lt;div class="dropdown-content"&gt;
56+
}
57+
}
58+
59+
X:if "position() != last()" {
60+
X:if "$YEAR=@year" {
61+
<b><a href="{@href}">!{@year}</a></b>
62+
} else {
63+
<a href="{@href}">!{@year}</a>
64+
}
65+
}
66+
67+
X:if "position() = last()" {
68+
X:if "$YEAR=@year" {
69+
<b><a href="{@href}">!{@year}</a></b>
70+
} else {
71+
<a href="{@href}">!{@year}</a>
72+
}
73+
X:text disable-output-escaping="yes" {
74+
&lt;/div&gt;&lt;/div&gt;
75+
}
76+
}
77+
}
5078

5179
X:template = "event" {
5280

5381
X:var year = { !{substring(../event[position()=1]/@date, 1, 4)} }
5482
X:var y = { !{substring(@date, 1, 4)} }
5583

56-
X:if "position() = 1" {
84+
<!-- News items start at position 2 so that we skip the dropdown menu -->
85+
X:if "position() = 2" {
5786
X:text disable-output-escaping="yes" {
5887
&lt;table class="news"&gt;
5988
}
6089
}
6190

62-
X:if "(not($YEAR) and ($year = $y or position() &lt; 11)) or $YEAR=$y" {
91+
X:if "(not($YEAR) and ($year = $y or position() &lt; 12)) or $YEAR=$y" {
6392
<tr>
6493
<td class="date">
6594
<a name="{@date}" /> !{@date}

0 commit comments

Comments
 (0)