diff --git a/README.md b/README.md index c0c327c5..34d3ea09 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Blowfish is designed to be a powerful, lightweight theme for [Hugo](https://gohu - Firebase integration to support dynamic data - Views count & like mechanism - Multiple homepage layouts +- Support for multiple authors - Flexible with any content types, taxonomies and menus - Multilingual content support inlcuding support for RTL languages - Ability to link to posts on third-party websites diff --git a/assets/css/compiled/main.css b/assets/css/compiled/main.css index 58ce1186..f9114728 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -1530,6 +1530,10 @@ select { margin-top: 0.1rem; } +.mt-4 { + margin-top: 1rem; +} + .\!mt-0 { margin-top: 0px !important; } diff --git a/assets/img/author2.png b/assets/img/author2.png new file mode 100644 index 00000000..c1a3c061 Binary files /dev/null and b/assets/img/author2.png differ diff --git a/assets/img/nuno_avatar.jpg b/assets/img/nuno_avatar.jpg new file mode 100644 index 00000000..c350016d Binary files /dev/null and b/assets/img/nuno_avatar.jpg differ diff --git a/config/_default/config.toml b/config/_default/config.toml index 15ed52ee..8197c0e3 100644 --- a/config/_default/config.toml +++ b/config/_default/config.toml @@ -14,6 +14,11 @@ buildFuture = false # googleAnalytics = "G-XXXXXXXXX" +[taxonomies] + tag = "tags" + category = "categories" + author = "authors" + [sitemap] changefreq = 'daily' filename = 'sitemap.xml' diff --git a/config/_default/params.toml b/config/_default/params.toml index ee667558..204d97af 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -46,6 +46,7 @@ enableCodeCopy = true showReadingTime = true showTableOfContents = true showTaxonomies = false + showAuthorsBadges = false showWordCount = true showSummary = true sharingLinks = [ "linkedin", "twitter", "whatsapp", "pinterest", "reddit", "facebook", "email"] diff --git a/exampleSite/config/_default/config.toml b/exampleSite/config/_default/config.toml index 8f9c463b..7da10330 100644 --- a/exampleSite/config/_default/config.toml +++ b/exampleSite/config/_default/config.toml @@ -15,6 +15,11 @@ buildFuture = false googleAnalytics = "G-PEDMYR1V0K" +[taxonomies] + tag = "tags" + category = "categories" + author = "authors" + [sitemap] changefreq = 'daily' filename = 'sitemap.xml' diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 2a9e8f00..fa8bdd59 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -46,6 +46,7 @@ mainSections = ["docs"] showReadingTime = true showTableOfContents = true showTaxonomies = true + showAuthorsBadges = true showWordCount = false showSummary = true sharingLinks = [ "linkedin", "twitter", "whatsapp", "pinterest", "reddit", "facebook", "email"] diff --git a/exampleSite/content/.Ulysses-Settings.plist b/exampleSite/content/.Ulysses-Settings.plist new file mode 100644 index 00000000..fe51321e --- /dev/null +++ b/exampleSite/content/.Ulysses-Settings.plist @@ -0,0 +1,14 @@ + + + + + defaultPathExtensions + md + enforceFencedCodeBlocks + + sheetFormat + foreign + useInlineLinks + + + diff --git a/exampleSite/content/authors/_index.md b/exampleSite/content/authors/_index.md new file mode 100644 index 00000000..d7fdb280 --- /dev/null +++ b/exampleSite/content/authors/_index.md @@ -0,0 +1,10 @@ +--- +title: "Authors Taxonomy Listing Example" +date: 2022-10-12 +draft: false +description: "Turn on thumbnails for your articles." +tags: ["thumbnail", "sample"] +summary: "A quick example of how to start using Thumbnails in your artciles." +--- + +A quick example of how to start using Thumbnails in your articles. diff --git a/exampleSite/content/authors/nunocoracao/_index.md b/exampleSite/content/authors/nunocoracao/_index.md new file mode 100644 index 00000000..caf70558 --- /dev/null +++ b/exampleSite/content/authors/nunocoracao/_index.md @@ -0,0 +1,5 @@ +--- +title: "Nuno Coração" +--- + +Nuno's awesome dummy bio. diff --git a/exampleSite/content/authors/secondauthor/_index.md b/exampleSite/content/authors/secondauthor/_index.md new file mode 100644 index 00000000..039f902d --- /dev/null +++ b/exampleSite/content/authors/secondauthor/_index.md @@ -0,0 +1,5 @@ +--- +title: "Dummy Second Author" +--- + +Dummy Second Author's awesome dummy bio. diff --git a/exampleSite/content/docs/configuration/index.md b/exampleSite/content/docs/configuration/index.md index 854ea74c..31e9f602 100644 --- a/exampleSite/content/docs/configuration/index.md +++ b/exampleSite/content/docs/configuration/index.md @@ -156,6 +156,7 @@ Many of the article defaults here can be overridden on a per article basis by sp |`article.showReadingTime`|`true`|Whether or not article reading times are displayed.| |`article.showTableOfContents`|`false`|Whether or not the table of contents is displayed on articles.| |`article.showTaxonomies`|`false`|Whether or not the taxonomies related to this article are displayed.| +|`article.showAuthorsBadges`|`false`|Whether the `authors` taxonomies are are displayed in the article or list header. This requires the setup of `multiple authors` and the `authors` taxonomy. Check [this page]({{< ref "multi-author" >}}) for more details on how to configure that feature.| |`article.showWordCount`|`false`|Whether or not article word counts are displayed.| |`article.showComments`|`false`|Whether or not the [comments partial]({{< ref "partials#comments" >}}) is included after the article footer.| |`article.sharingLinks`|_Not set_|Which sharing links to display at the end of each article. When not provided, or set to `false` no links will be displayed.| diff --git a/exampleSite/content/docs/front-matter/index.md b/exampleSite/content/docs/front-matter/index.md index f07de750..87778b27 100644 --- a/exampleSite/content/docs/front-matter/index.md +++ b/exampleSite/content/docs/front-matter/index.md @@ -23,7 +23,9 @@ Front matter parameter default values are inherited from the theme's [base confi |`menu`|_Not set_|When a value is provided, a link to this article will appear in the named menus. Valid values are `main` or `footer`.| |`robots`|_Not set_|String that indicates how robots should handle this article. If set, it will be output in the page head. Refer to [Google's docs](https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#directives) for valid values.| |`sharingLinks`|`article.sharingLinks`|Which sharing links to display at the end of this article. When not provided, or set to `false` no links will be displayed.| -|`showAuthor`|`article.showAuthor`|Whether or not the author box is displayed in the article footer.| +|`showAuthor`|`article.showAuthor`|Whether or not the author box for the deafult author is displayed in the article footer.| +|`authors`|_Not set_|Array of values for authors, if set it overrides `showAuthor` settings for page or site. Used on the multiple authors feature, check [this page]({{< ref "multi-author" >}}) for more details on how to configure that feature.| +|`showAuthorsBadges`|`article.showAuthorsBadges`|Whether the `authors` taxonomies are are displayed in the article or list header. This requires the setup of `multiple authors` and the `authors` taxonomy. Check [this page]({{< ref "multi-author" >}}) for more details on how to configure that feature.| |`showBreadcrumbs`|`article.showBreadcrumbs` or `list.showBreadcrumbs`|Whether the breadcrumbs are displayed in the article or list header.| |`showDate`|`article.showDate`|Whether or not the article date is displayed. The date is set using the `date` parameter.| |`showDateUpdated`|`article.showDateUpdated`|Whether or not the date the article was updated is displayed. The date is set using the `lastmod` parameter.| diff --git a/exampleSite/content/docs/multi-author/featured.png b/exampleSite/content/docs/multi-author/featured.png new file mode 100644 index 00000000..b16c8a4b Binary files /dev/null and b/exampleSite/content/docs/multi-author/featured.png differ diff --git a/exampleSite/content/docs/multi-author/index.md b/exampleSite/content/docs/multi-author/index.md new file mode 100644 index 00000000..5c1a884f --- /dev/null +++ b/exampleSite/content/docs/multi-author/index.md @@ -0,0 +1,100 @@ +--- +title: "Multiple Authors" +date: 2020-08-10 +draft: false +description: "Configure multiple authors for your articles." +slug: "multi-author" +tags: ["authors", "config", "docs"] +showAuthor: true +authors: + - "nunocoracao" +showAuthorsBadges : false +--- + + +Some websites have more than one author contributing with content and therefore require more than a single default author across the entire website. For those use-cases, Blowfish allows users to extend the list of authors using the multiple authors feature. + +To keep everything backwards compatible, this feature only allows the definition of extra authors and does not change in any way the previous author functionality which is used via config files. + + +## Create Authors + +The first step to create new authors is to set up a new folder in `./data/authors`. Then you can simply add new `json` files inside, one for each new author. The name of the file will be the `key` for that author when referencing it in your articles. + +As an example, let’s create a file called `nunocoracao.json` within `./data/authors`. The contents of the file should be similar to the ones below. `name`, `image`, `bio`, and `social` are the 4 parameters supported right for authors. They mimic the configurations available for the default author in the config files. + +_Note: the key in the social object will be used to fetch one of the theme’s icons, feel free to use any of the icons available in your setup._ + +```json +{ + "name": "Nuno Coração", + "image" : "img/nuno_avatar.jpg", + "bio": "Theme Creator", + "social": { + "linkedin": "https://linkedin.com/in/nunocoracao", + "twitter": "https://twitter.com/nunocoracao", + "instagram": "https://instagram.com/nunocoracao", + "medium": "https://medium.com/@nunocoracao", + "github": "https://github.com/nunocoracao", + "goodreads": "http://goodreads.com/nunocoracao", + "keybase": "https://keybase.io/nunocoracao", + "reddit": "https://reddit.com/user/nunoheart" + } +} +``` + + +## Reference Authors in Articles + +Now that you created one author, the next step is to reference it in one or more articles. In the example below, we reference the author created in the previous step using its `key`. + +This will render an extra author using the data provided in the `json` file. This feature does not change in any way the default author configured for the overall site, and therefore, you can control both separately. Using the `showAuthor` parameter, you can configure whether to show the default author, that is the normal use-case for a single author blog. The new `authors` front-matter parameter allows you to define authors specifically to an article, and they will be rendered independently of the configurations for the default site author. + +```md +--- +title: "Multiple Authors" +date: 2020-08-10 +draft: false +description: "Configure multiple authors for your articles." +slug: "multi-author" +tags: ["authors", "config", "docs"] +showAuthor: true +authors: + - "nunocoracao" +showAuthorsBadges : false +--- +``` + +In the example, which matches the markdown of the current page, both the default author and the new one will be displayed. You can scroll now to see the outcome. + +## Create the Authors Taxonomy + +To get lists of articles for each of your authors you can configure the `authors` taxonomy, which opens up some more configurations that might be interesting. This is an optional step in the process that is not required to display the authors in your articles. + +First step is to configure the `authors` taxonomy in your `config.toml` file, like in the example below. Even though `tag` and `category` are defined by default with Hugo, once you add a specific taxonomies section you need to add them again otherwise the site will not process them. + +```toml +[taxonomies] + tag = "tags" + category = "categories" + author = "authors" +``` + +And that’s just about it. Now you will have pages that reference your authors and, for each, show the respective list of articles where they participate. You can also use the `article.showAuthorsBadges` on the config file, or `showAuthorsBadges` on each article to chose whether to display the `authors` taxonomy as badges in each post item. As an example, this doc is configured to not display authors but if you look at the sample referenced below you will see the authors displayed as badges. + +Lastly, you can add more detail to each author page so that it displays a little bio, links, or whatever information fits your use-case. To achieve that, create a folder with the `key` to each author inside `./content/authors` and inside each folder place a `_index.md` file. For the example above, we would end up with a `.content/authors/nunocoracao/_index.md` file. Inside, you can configure the actual name of the author and the contents of their page. Authors in this documentation website are configured like this, so you can have a look by playing around with the site. + +```md +--- +title: "Nuno Coração" +--- + +Nuno's awesome dummy bio. + +``` + +## Sample + +The sample below shows an example where the default site author is turned off and the article has multiple authors. + +{{< article link="/blowfish/samples/multiple-authors/" >}} \ No newline at end of file diff --git a/exampleSite/content/samples/multiple-authors.md b/exampleSite/content/samples/multiple-authors.md new file mode 100644 index 00000000..0db8882e --- /dev/null +++ b/exampleSite/content/samples/multiple-authors.md @@ -0,0 +1,18 @@ +--- +title: "Multiple Authors" +date: 2022-10-12 +draft: false +description: "Sample for a multiple author setup" +tags: ["authors", "sample"] +summary: "A quick example of how multiple authors could be used." +showAuthor: false +authors: + - "nunocoracao" + - "secondauthor" +--- + +This is an example of how an article with multiple authors will look like. + +Check the article below for details on how to configure the feature. + +{{< article link="/blowfish/docs/multi-author/" >}} \ No newline at end of file diff --git a/exampleSite/data/authors/nunocoracao.json b/exampleSite/data/authors/nunocoracao.json new file mode 100644 index 00000000..ecf62ede --- /dev/null +++ b/exampleSite/data/authors/nunocoracao.json @@ -0,0 +1,15 @@ +{ + "name": "Nuno Coração", + "image" : "img/nuno_avatar.jpg", + "bio": "Theme Creator", + "social": { + "linkedin": "https://linkedin.com/in/nunocoracao", + "twitter": "https://twitter.com/nunocoracao", + "instagram": "https://instagram.com/nunocoracao", + "medium": "https://medium.com/@nunocoracao", + "github": "https://github.com/nunocoracao", + "goodreads": "http://goodreads.com/nunocoracao", + "keybase": "https://keybase.io/nunocoracao", + "reddit": "https://reddit.com/user/nunoheart" + } +} \ No newline at end of file diff --git a/exampleSite/data/authors/secondauthor.json b/exampleSite/data/authors/secondauthor.json new file mode 100644 index 00000000..98d77afd --- /dev/null +++ b/exampleSite/data/authors/secondauthor.json @@ -0,0 +1,15 @@ +{ + "name": "Dummy Second Author", + "image" : "img/author2.png", + "bio": "Dummy", + "social": { + "linkedin": "https://linkedin.com/in/nunocoracao", + "twitter": "https://twitter.com/nunocoracao", + "instagram": "https://instagram.com/nunocoracao", + "medium": "https://medium.com/@nunocoracao", + "github": "https://github.com/nunocoracao", + "goodreads": "http://goodreads.com/nunocoracao", + "keybase": "https://keybase.io/nunocoracao", + "reddit": "https://reddit.com/user/nunoheart" + } +} \ No newline at end of file diff --git a/exampleSite/resources/_gen/images/author2_hub6c74558734540774552b319ec2c6c70_1552535_192x192_fill_box_smart1_3.png b/exampleSite/resources/_gen/images/author2_hub6c74558734540774552b319ec2c6c70_1552535_192x192_fill_box_smart1_3.png new file mode 100644 index 00000000..5d354c68 Binary files /dev/null and b/exampleSite/resources/_gen/images/author2_hub6c74558734540774552b319ec2c6c70_1552535_192x192_fill_box_smart1_3.png differ diff --git a/exampleSite/resources/_gen/images/nuno_avatar_hu8b7a4bd74a55738ace1e1f4e4161419f_113497_192x192_fill_q75_box_smart1.jpg b/exampleSite/resources/_gen/images/nuno_avatar_hu8b7a4bd74a55738ace1e1f4e4161419f_113497_192x192_fill_q75_box_smart1.jpg new file mode 100644 index 00000000..3981fc20 Binary files /dev/null and b/exampleSite/resources/_gen/images/nuno_avatar_hu8b7a4bd74a55738ace1e1f4e4161419f_113497_192x192_fill_q75_box_smart1.jpg differ diff --git a/layouts/_default/single.html b/layouts/_default/single.html index bba6fff9..aa1d800b 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -138,7 +138,27 @@