Browse Source

Related articles feature and some improvements

pull/18/head
Özcan Oğuz 11 months ago
parent
commit
3430643870
Signed by: ooguz GPG Key ID: 2D33E2BD3D975818
  1. 19
      config.toml
  2. 3
      i18n/en.toml
  3. 5
      i18n/tr.toml
  4. 6
      layouts/_default/baseof.html
  5. 3
      layouts/_default/single.html
  6. 10
      layouts/partials/related.html
  7. 5
      static/css/style.css

19
config.toml

@ -155,5 +155,24 @@ ignoreFiles = ["\\.Rmd$", "_files$", "_cache$"]
MathJaxCDN = "//cdn.bootcss.com"
MathJaxVersion = "2.7.1"
[related]
includeNewer = false
threshold = 80
toLower = false
[[related.indices]]
name = "keywords"
weight = 100
[[related.indices]]
name = "categories"
weight = 100
[[related.indices]]
name = "date"
weight = 10
[markup.goldmark.renderer]
unsafe= true

3
i18n/en.toml

@ -30,3 +30,6 @@ other = "Source code"
[gorsel]
other = "Photo: "
[related]
other = "More articles you may like"

5
i18n/tr.toml

@ -29,4 +29,7 @@ other = "Özgür Yazılım Derneği, özgür yazılım hareketini ve tüm insanl
other = "Kaynak kodu"
[gorsel]
other = "Görsel: "
other = "Görsel: "
[related]
other = "İlginizi çekebilecek diğer yazılar"

6
layouts/_default/baseof.html

@ -2,15 +2,16 @@
<html lang="{{ .Site.Language.Lang }}">
<head>
<meta charset="utf-8">
<meta name="description" content="{{ i18n "desc_summary" }}" />
<meta name="robots" content="index, follow" />
<link rel="canonical" href="http://www.oyd.org.tr/" />
<meta name="viewport" content="width=device-width, initial-scale=1">
{{ if .IsPage }}
<meta name="description" content="{{ .Page.Summary }}" />
<meta property="og:title" content="{{ .Page.Title }} - {{ .Site.Title }}" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://www.oyd.org.tr" />
<meta property="og:description" content="{{ .Description }}" />
<meta property="og:description" content="{{ .Page.Summary }}" />
<meta property="og:image" content="/oyd_social.png?v=2" />
<meta property="og:site_name" content="Özgür Yazılım Derneği" />
<meta name="twitter:card" content="summary_large_image" />
@ -20,6 +21,7 @@
<meta name="twitter:creator" content="@oydorgtr" />
<meta name="twitter:image" content="https://oyd.org.tr/oyd_social.png?4812354">
{{ else }}
<meta name="description" content="{{ i18n "desc_summary" }}" />
<meta property="og:title" content="{{ .Site.Title }}" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://www.oyd.org.tr" />

3
layouts/_default/single.html

@ -12,6 +12,9 @@
</div>
{{ end }}
{{ .Content }}
{{ if (or (eq .Section "yazilar") (eq .Section "articles")) }}
{{ partial "related" . }}
{{ end }}
</article>
<aside class="sidebar">
<h2 class="title">{{ i18n "etkinlikler" }}</h2>

10
layouts/partials/related.html

@ -0,0 +1,10 @@
<hr>
{{ $related := .Site.RegularPages.Related . | first 5 }}
{{ with $related }}
<h3>{{ i18n "related" }}</h3>
<ul>
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
{{ end }}

5
static/css/style.css

@ -186,6 +186,10 @@ article hr:last-child {
display: none;
}
article hr {
color: #4c2447;
}
.list-title {
font-size: 1.2rem;
}
@ -930,3 +934,4 @@ table {
display: none;
}
}
Loading…
Cancel
Save