Skip to content

Commit a8646d5

Browse files
committed
made the link on the news page to the actual publication item
1 parent 5bbeb95 commit a8646d5

File tree

5 files changed

+82
-10
lines changed

5 files changed

+82
-10
lines changed

_quarto.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ website:
4848
href: site/various/privacy.qmd
4949
- text: Terms of Use
5050
href: site/various/terms.qmd
51+
center: ""
5152
format:
5253
html:
5354
theme:

custom.scss

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,35 @@ div.quarto-post {
118118
p {
119119
text-align: justify;
120120
}
121+
122+
// Ensure anchor scrolling works inside grid/flex containers
123+
.publication-anchor, a[id] {
124+
scroll-margin-top: 80px; // Adjust to your header height
125+
}
126+
127+
@media (max-width: 600px) {
128+
a[id], .publication-anchor {
129+
scroll-margin-top: 120px; // or more, adjust to your mobile header height
130+
}
131+
}
132+
133+
.nav-footer-center {
134+
height: 0px;
135+
max-height: 0px;
136+
overflow: hidden;
137+
display: flex;
138+
justify-content: center;
139+
}
140+
141+
.nav-footer-left {
142+
display: inline-block;
143+
margin: 0 10px;
144+
font-size: 0.9em;
145+
}
146+
147+
@media screen and (max-width: 768px) {
148+
.nav-footer-center {
149+
display: none; // Hide left footer on small screens
150+
}
151+
152+
}

index.qmd

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@ description: <h1>COMPUTO</h1> A journal of the <a href="https://sfds.asso.fr/">F
33
Statistical Society <img height="10px" src="assets/img/sfds.png" alt="SFdS"/></a>
44
- ISSN 2824-7795
55
listing:
6-
contents: news.yml
7-
sort: date desc
8-
page-size: 5
9-
fields:
10-
- date
11-
- description
12-
feed:
13-
items: 5
6+
- id: published
7+
template: site/news.ejs
8+
contents: site/published.yml
9+
sort: date desc
1410
---
1511

1612
:::: {layout="[30,70]" style="display: flex; margin-bottom: 3em;"}

site/news.ejs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
```{=html}
2+
<%
3+
// Only show articles from this year (2025) and not drafts
4+
const currentYear = new Date().getFullYear();
5+
for (const item of items) {
6+
if (!item.draft && item.year == currentYear) { %>
7+
<a href="/site/publications.html#<%= item.repo %>" class="list-group-item list-group-item-action">
8+
<strong><%= item.date %></strong>
9+
<%= item.title %>
10+
<% if (item.authors) { %>
11+
by <%= item.authors %>
12+
<% } %>
13+
<!-- <% if (item.url && item.url.trim()) { %>
14+
[<a href="<%= item.url %>" target="_blank">link</a>]
15+
<% } %> -->
16+
</a>
17+
<% }
18+
} %>
19+
```
20+

site/publications.ejs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ for (const item of items) {
1515
<div class="row year-section">
1616
<% currentYear = item.year;
1717
} %>
18+
<a id="<%= item.repo %>" class="publication-anchor"></a>
1819
<div class="col-12 mb-3">
1920
<div class="card">
2021
<div class="card-body">
21-
<div class="row align-items-center border-left border-primary">
22+
<div class="row align-items-center">
2223
<div class="col-md-2">
2324
<a href="https://github.com/computorg/<%- item.repo %>" target="_blank">
24-
<img style="width:100px;" src=https://img.shields.io/github/actions/workflow/status/computorg/<%- item.repo %>/build.yml?label=build&logo=github" class="img-fluid" alt="Build Status">
25+
<img src="https://img.shields.io/github/actions/workflow/status/computorg/<%- item.repo %>/build.yml?label=build&logo=github" class="img-fluid" alt="Build Status">
2526
</a>
2627
</div>
2728
<div class="col-md-10">
@@ -137,5 +138,27 @@ for (const item of items) {
137138
// Show a temporary alert
138139
alert('BibTeX citation copied to clipboard!');
139140
}
141+
142+
document.addEventListener("DOMContentLoaded", function() {
143+
if (window.location.hash) {
144+
var el = document.getElementById(window.location.hash.substring(1));
145+
if (el) {
146+
el.scrollIntoView({ behavior: "auto", block: "center" });
147+
}
148+
}
149+
});
150+
document.addEventListener("DOMContentLoaded", function() {
151+
function scrollToAnchor() {
152+
if (window.location.hash) {
153+
var el = document.getElementById(window.location.hash.substring(1));
154+
if (el) {
155+
el.scrollIntoView({ behavior: "auto", block: "center" });
156+
}
157+
}
158+
}
159+
// Try immediately, then again after a short delay (for mobile/layout shifts)
160+
scrollToAnchor();
161+
setTimeout(scrollToAnchor, 400);
162+
});
140163
</script>
141164
```

0 commit comments

Comments
 (0)