Skip to content

Commit 5b7503f

Browse files
brunoborgesCopilot
andcommitted
Fix share URLs and move share section below code comparison
- Fix missing category in share URLs (was /slug.html, now /category/slug.html) - Move social share buttons from bottom of page to right below the old/modern code comparison section Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 097ea15 commit 5b7503f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

html-generators/generate.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ String renderRelatedSection(String tpl, Snippet snippet, Map<String, Snippet> al
434434
.collect(Collectors.joining("\n"));
435435
}
436436

437-
String renderSocialShare(String tpl, String slug, String title, Map<String, String> strings) {
438-
var encodedUrl = urlEncode("%s/%s.html".formatted(BASE_URL, slug));
437+
String renderSocialShare(String tpl, String category, String slug, String title, Map<String, String> strings) {
438+
var encodedUrl = urlEncode("%s/%s/%s.html".formatted(BASE_URL, category, slug));
439439
var encodedText = urlEncode("%s \u2013 java.evolved".formatted(title));
440440
return replaceTokens(tpl, Map.of("encodedUrl", encodedUrl, "encodedText", encodedText,
441441
"share.label", strings.getOrDefault("share.label", "Share")));
@@ -496,7 +496,7 @@ String generateHtml(Templates tpl, Snippet s, Map<String, Snippet> all, Map<Stri
496496
Map.entry("docLinks", renderDocLinks(tpl.docLink(), s.node().withArray("docs"))),
497497
Map.entry("proofSection", renderProofSection(s, extraTokens)),
498498
Map.entry("relatedCards", renderRelatedSection(tpl.relatedCard(), s, all, locale, extraTokens)),
499-
Map.entry("socialShare", renderSocialShare(tpl.socialShare(), s.slug(), s.title(), extraTokens))));
499+
Map.entry("socialShare", renderSocialShare(tpl.socialShare(), s.category(), s.slug(), s.title(), extraTokens))));
500500
var localeName = LOCALES.getOrDefault(locale, locale);
501501
tokens.putAll(buildContributeUrls(s, locale, localeName));
502502
return replaceTokens(tpl.page(), tokens);

templates/slug-template.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ <h1>{{title}}</h1>
165165
</div>
166166
</section>
167167

168+
{{socialShare}}
169+
168170
<div class="contribute-inline">
169171
{{contribute.seeIssue}} <a href="{{contributeCodeIssueUrl}}" target="_blank" rel="noopener">{{contribute.reportIt}}</a>
170172
</div>
@@ -228,8 +230,6 @@ <h1>{{title}}</h1>
228230
</section>
229231

230232

231-
{{socialShare}}
232-
233233
<footer>
234234
<p><a href="{{homeUrl}}">java.evolved</a> — {{footer.tagline}}</p>
235235
<p>{{footer.madeWith}} <a href="https://github.com/brunoborges" target="_blank" rel="noopener">Bruno Borges</a> {{footer.and}} <a href="https://github.com/features/copilot" target="_blank" rel="noopener">GitHub Copilot</a></p>

0 commit comments

Comments
 (0)