Skip to content

Commit

Permalink
Allow frontpage news links to redirect to arbitrary locations (#66)
Browse files Browse the repository at this point in the history
Co-authored-by: Jarrod Millman <jarrod.millman@gmail.com>
  • Loading branch information
stefanv and jarrodmillman authored Nov 9, 2021
1 parent ca99c77 commit 71e8b60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions doc/content/getstarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ The first post from `/content/en/news` will be highlighted on the
front page. If you don't want that, remove the `/content/en/news`
folder.
By default, news items link to the `/news` category page (which lists all news items).
You can override that by setting `newsLink` in the preamble of any news post.
## Code styling
To enable code styling, add the following to your config file:
Expand Down
5 changes: 3 additions & 2 deletions layouts/partials/news.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{ range first 1 (where .Site.RegularPages "Section" "news") }}
{{ $newsLink := default "/news" .Params.newsLink }}
<div class="news-container">
<div class="news-title"><a href="{{ relURL "/news" }}"> {{ .Title }}</a></div>
<div class="news-date"><a href="{{ relURL "/news" }}">{{ .Date.Format "2006-01-02" }}</a></div>
<div class="news-title"><a href="{{ relURL $newsLink }}"> {{ .Title }}</a></div>
<div class="news-date"><a href="{{ relURL $newsLink }}">{{ .Date.Format "2006-01-02" }}</a></div>
</div>
{{ end }}

0 comments on commit 71e8b60

Please sign in to comment.