From owner-dev-commits-doc-all@freebsd.org Thu Jul 15 22:21:39 2021 Return-Path: Delivered-To: dev-commits-doc-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 74C2D652591 for ; Thu, 15 Jul 2021 22:21:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GQpkW2tDBz4hLH; Thu, 15 Jul 2021 22:21:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B89211CEB; Thu, 15 Jul 2021 22:21:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16FMLdGY032809; Thu, 15 Jul 2021 22:21:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16FMLdxK032808; Thu, 15 Jul 2021 22:21:39 GMT (envelope-from git) Date: Thu, 15 Jul 2021 22:21:39 GMT Message-Id: <202107152221.16FMLdxK032808@gitrepo.freebsd.org> To: doc-committers@FreeBSD.org, dev-commits-doc-all@FreeBSD.org From: "Danilo G. Baio" Subject: git: e06f3556be - main - website/press: Adjust all links MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dbaio X-Git-Repository: doc X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e06f3556beb198cbaf10136ad54af94e19cebf10 Auto-Submitted: auto-generated X-BeenThere: dev-commits-doc-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the doc repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 22:21:39 -0000 The branch main has been updated by dbaio: URL: https://cgit.FreeBSD.org/doc/commit/?id=e06f3556beb198cbaf10136ad54af94e19cebf10 commit e06f3556beb198cbaf10136ad54af94e19cebf10 Author: Danilo G. Baio AuthorDate: 2021-07-15 11:48:00 +0000 Commit: Danilo G. Baio CommitDate: 2021-07-15 22:09:25 +0000 website/press: Adjust all links - Fix RSS/Feed links They were without the anchor part, causing 404 requests: https://www.freebsd.org/press/2021-03:0 The correct is: https://www.freebsd.org/press/#2021-03:0 - Make links unique When investigating the above issue, we could note that the links were not unique. Every time a new press item is added, the entire chain of links is changed. We add the old behavior with this change, which counts press items for each month and generates the unique link based on the month and in the month counter. This change also needs to be added to the News and Events items. Reviewed by: carlavilla Differential Revision: https://reviews.freebsd.org/D31190 --- website/themes/beastie/layouts/partials/press.html | 13 +++++++++-- website/themes/beastie/layouts/press/list.html | 13 ++++++++--- website/themes/beastie/layouts/press/press.rss.xml | 27 ++++++++++++++-------- website/themes/beastie/layouts/press/single.html | 13 ++++++++--- 4 files changed, 49 insertions(+), 17 deletions(-) diff --git a/website/themes/beastie/layouts/partials/press.html b/website/themes/beastie/layouts/partials/press.html index ca0e3c1d16..6bca5eece6 100644 --- a/website/themes/beastie/layouts/partials/press.html +++ b/website/themes/beastie/layouts/partials/press.html @@ -16,14 +16,23 @@ {{ with $pressData.press }} {{ $pressCounter := 0 }} + {{ $pressMonthCounter := 1 }} + {{ $pressMonthPrev := false }} {{ range (sort .press "date" "desc") }} {{ if lt $pressCounter 5 }} + {{ $pressMonthCur := dateFormat "2006-01" .date }} + {{ if eq $pressMonthCur $pressMonthPrev }} + {{ $pressMonthCounter = add $pressMonthCounter 1 }} + {{ else }} + {{ $pressMonthCounter = 1 }} + {{ end }}

{{ dateFormat "2006-01" .date }}
- {{ .name }} + {{ .name }}

+ {{ $pressCounter = add $pressCounter 1 }} + {{ $pressMonthPrev = $pressMonthCur }} {{ end }} - {{ $pressCounter = add $pressCounter 1 }} {{ end }} {{ end }} diff --git a/website/themes/beastie/layouts/press/list.html b/website/themes/beastie/layouts/press/list.html index f34ae7e986..332c4de940 100644 --- a/website/themes/beastie/layouts/press/list.html +++ b/website/themes/beastie/layouts/press/list.html @@ -39,7 +39,8 @@ {{ $yearsMonths = $yearsMonths | uniq }} - {{ $pressCounter := 0 }} + {{ $pressMonthCounter := 1 }} + {{ $pressMonthPrev := false }} {{ range $year := seq now.Year 2010 }} {{ range $month := seq 12 1 }} {{ $yearMonth := (printf "%d-%d" $year $month) }} @@ -50,9 +51,15 @@ {{ with $pressData.press }} {{ range (sort .press "date" "desc") }} {{ if eq (dateFormat "2006-1" .date) $yearMonth }} + {{ $pressMonthCur := dateFormat "2006-01" .date }} + {{ if eq $pressMonthCur $pressMonthPrev }} + {{ $pressMonthCounter = add $pressMonthCounter 1 }} + {{ else }} + {{ $pressMonthCounter = 1 }} + {{ end }}
  • - + {{ .name }} @@ -62,7 +69,7 @@ {{ .description | safeHTML}}

  • - {{ $pressCounter = add $pressCounter 1 }} + {{ $pressMonthPrev = $pressMonthCur }} {{ end }} {{ end }} {{ end }} diff --git a/website/themes/beastie/layouts/press/press.rss.xml b/website/themes/beastie/layouts/press/press.rss.xml index 98f0348c85..660c49652d 100644 --- a/website/themes/beastie/layouts/press/press.rss.xml +++ b/website/themes/beastie/layouts/press/press.rss.xml @@ -12,28 +12,37 @@ https://www.FreeBSD.org/press/ + {{ $pressMonthPrev := false }} {{ $data := index .Site.Data "en" }} {{ $pressData := $data.press }} {{ with $pressData.press }} {{ $pressCounter := 0 }} - {{ range (sort .press "date" "desc") }} - {{ if lt $pressCounter 10 }} + {{ $pressMonthCounter := 1 }} + {{ range (sort .press "date" "desc") }} + {{ if lt $pressCounter 10 }} + {{ $pressMonthCur := dateFormat "2006-01" .date }} + {{ if eq $pressMonthCur $pressMonthPrev }} + {{ $pressMonthCounter = add $pressMonthCounter 1 }} + {{ else }} + {{ $pressMonthCounter = 1 }} + {{ end }} - {{ if .name }} + {{ if .name }} {{ .name }} - {{ end }} - {{ if .description }} + {{ end }} + {{ if .description }} {{ .description }} - {{ end }} - {{ absLangURL ($.Site.BaseURL) }}press/{{ dateFormat "2006-01" .date }}:{{ $pressCounter }} - {{ absLangURL ($.Site.BaseURL) }}press/{{ dateFormat "2006-01" .date }}:{{ $pressCounter }} + {{ end }} + {{ absLangURL ($.Site.BaseURL) }}press/#{{ dateFormat "2006-01" .date }}:{{ $pressMonthCounter }} + {{ absLangURL ($.Site.BaseURL) }}press/#{{ dateFormat "2006-01" .date }}:{{ $pressMonthCounter }} {{ dateFormat "2006-01-02" .date }} - {{ end }} + {{ $pressMonthPrev = $pressMonthCur }} + {{ end }} {{ $pressCounter = add $pressCounter 1 }} {{ end }} {{ end }} diff --git a/website/themes/beastie/layouts/press/single.html b/website/themes/beastie/layouts/press/single.html index f34ae7e986..332c4de940 100644 --- a/website/themes/beastie/layouts/press/single.html +++ b/website/themes/beastie/layouts/press/single.html @@ -39,7 +39,8 @@ {{ $yearsMonths = $yearsMonths | uniq }} - {{ $pressCounter := 0 }} + {{ $pressMonthCounter := 1 }} + {{ $pressMonthPrev := false }} {{ range $year := seq now.Year 2010 }} {{ range $month := seq 12 1 }} {{ $yearMonth := (printf "%d-%d" $year $month) }} @@ -50,9 +51,15 @@ {{ with $pressData.press }} {{ range (sort .press "date" "desc") }} {{ if eq (dateFormat "2006-1" .date) $yearMonth }} + {{ $pressMonthCur := dateFormat "2006-01" .date }} + {{ if eq $pressMonthCur $pressMonthPrev }} + {{ $pressMonthCounter = add $pressMonthCounter 1 }} + {{ else }} + {{ $pressMonthCounter = 1 }} + {{ end }}
  • - + {{ .name }} @@ -62,7 +69,7 @@ {{ .description | safeHTML}}

  • - {{ $pressCounter = add $pressCounter 1 }} + {{ $pressMonthPrev = $pressMonthCur }} {{ end }} {{ end }} {{ end }}