Skip to content

Commit

Permalink
Add author to articles
Browse files Browse the repository at this point in the history
  • Loading branch information
mirmousaviii committed Oct 26, 2023
1 parent 396531e commit 8c8fc5c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion content/page/sample.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Sample"
date: 2021-11-01T13:18:45+01:00

author: "Mostafa"
author: "Mostafa Mirmousavi"
categories: []
tags: []

Expand Down
19 changes: 19 additions & 0 deletions themes/mostafa-hugo-theme/assets/sass/_articles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,25 @@ article {
}
}

.author {
margin-top: 10px;
.link {
display: inline-block;
border: 1px solid #4c4c4c;
color: #7a7a7a;
border-radius: 4px;
font-family: $article-footer-font;
font-size: 0.7em;
padding: 2px 5px;
text-decoration: none;

&:hover {
color: $header-text-color;
border-color: #7a7a7a;
}
}
}

}

.footer {
Expand Down
10 changes: 10 additions & 0 deletions themes/mostafa-hugo-theme/layouts/partials/default-content.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,14 @@ <h2>{{ i18n "tableOfContents" | default "tableOfContents" }}</h2>
</div>
{{ end }}


{{ if .ctx.Params.author }}
<div class="author">
<a class="link" href="/author/{{ .ctx.Params.author | urlize }}">
<i class="fa fa-user"></i>
{{ .ctx.Params.author }}
</a>
</div>
{{ end }}

</div>

0 comments on commit 8c8fc5c

Please sign in to comment.