-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move site author configuration to params
- Loading branch information
1 parent
77b73fc
commit 23d7728
Showing
13 changed files
with
219 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,13 +133,6 @@ sitemap: | |
filename: sitemap.xml | ||
priority: 0.5 | ||
|
||
author: | ||
name: John Doe | ||
email: [email protected] | ||
github: john_doe | ||
twitter: john_doe | ||
location: 'Kyiv, Ukraine' | ||
|
||
# For more see https://gohugo.io/getting-started/configuration-markup/ | ||
markup: | ||
defaultMarkdownHandler: goldmark | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ keywords: | |
|
||
# A "copyright"-line to be added to RSS/Atom files. | ||
# "©" and "{year}" will be replaced by © and the current year. | ||
copyright: 'Copyright © 2019-{year} John Doe' | ||
copyright: 'Copyright © 2019-{year} Serghei Iakovlev' | ||
|
||
# Colour scheme. Options: red, orange, magenta, cyan, blue, brown | ||
colorScheme: '' | ||
|
@@ -88,6 +88,13 @@ seo: | |
# you have to set `googleAnalytics` param in config.yaml file. | ||
anonymizeIp: true | ||
|
||
author: | ||
name: Serghei Iakovlev | ||
email: [email protected] | ||
github: sergeyklay | ||
twitter: egreps | ||
location: 'Wrocław, Poland' | ||
|
||
social: | ||
# Array of Facebook Page Admin IDs for Domain Insights | ||
facebookAdminIds: [] | ||
|
@@ -96,7 +103,7 @@ social: | |
facebookId: '' | ||
|
||
# Twitter username for the website | ||
twitter: john_doe | ||
twitter: egreps | ||
|
||
# Configure search engine | ||
search: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{{- /* | ||
|
||
This partial is used to get the site author information. | ||
|
||
In Hugo v0.124.0, the site.Author variable was deprecated. Instead, it is recommended to use | ||
the "author" parameters in the site configuration file. | ||
|
||
This partial checks for the presence of author information in both site.Author and site.Params.author. | ||
If both are present, preference is given to site.Params.author. | ||
|
||
The result is stored in the $siteAuthor variable and returned by the partial. | ||
|
||
Usage: | ||
|
||
{{ $siteAuthor := partial "site-author.html" . }} | ||
|
||
{{ with $siteAuthor.name }} {{ . }} {{ end }} | ||
{{ with $siteAuthor.email }} {{ . }} {{ end }} | ||
{{ with $siteAuthor.github }} {{ . }} {{ end }} | ||
{{ with $siteAuthor.twitter }} {{ . }} {{ end }} | ||
{{ with $siteAuthor.location }} {{ . }} {{ end }} | ||
|
||
For more information, see: https://github.com/gohugoio/hugo/releases/tag/v0.124.0 | ||
*/ -}} | ||
|
||
{{- $siteAuthor := dict "name" "" "email" "" "github" "" "twitter" "" "location" "" -}} | ||
|
||
{{- if site.Params.author -}} | ||
{{- $siteAuthor = merge $siteAuthor site.Params.author -}} | ||
{{- else if site.Author -}} | ||
{{- $siteAuthor = merge $siteAuthor site.Author -}} | ||
{{- end -}} | ||
|
||
{{- return $siteAuthor -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
'use strict'; | ||
|
||
// @ts-check | ||
const { test, expect } = require('@playwright/test'); | ||
const jsdom = require('jsdom'); | ||
const { JSDOM } = jsdom; | ||
|
||
test('atom feed has correct updated field', async ({ page }) => { | ||
await page.goto('/feeds/feed.atom.xml'); | ||
|
||
// Get the content of the page | ||
const content = await page.content(); | ||
|
||
// Create a new JSDOM instance | ||
const dom = new JSDOM(content, { contentType: 'text/xml' }); | ||
|
||
// Get the global window object | ||
const { window } = dom; | ||
|
||
// Get the updated field | ||
const updatedField = window.document.querySelector('feed > updated'); | ||
|
||
// Check if the updated field exists | ||
expect(updatedField).not.toBeNull(); | ||
|
||
// Check if the updated field is not empty | ||
expect(updatedField.textContent).not.toBe(''); | ||
|
||
// Check if the updated field has the correct format | ||
const dateRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:Z|[+-]\d{2}:\d{2})$/; | ||
expect(updatedField.textContent).toMatch(dateRegex); | ||
}); | ||
|
||
test('atom feed has correct author information', async ({ page }) => { | ||
await page.goto('/feeds/feed.atom.xml'); | ||
|
||
// Get the content of the page | ||
const content = await page.content(); | ||
|
||
// Create a new JSDOM instance | ||
const dom = new JSDOM(content, { contentType: 'text/xml' }); | ||
|
||
// Get the global window object | ||
const { window } = dom; | ||
|
||
// Get the author element | ||
const authorElement = window.document.querySelector('feed > author'); | ||
|
||
// Check if the author element exists | ||
expect(authorElement).not.toBeNull(); | ||
|
||
// Get the name element | ||
const nameElement = authorElement.querySelector('name'); | ||
|
||
// Check if the name element exists | ||
expect(nameElement).not.toBeNull(); | ||
|
||
// Check if the name element has the correct type attribute | ||
expect(nameElement.getAttribute('type')).toBe('html'); | ||
|
||
// Check if the name element has the correct text content | ||
expect(nameElement.textContent).not.toBeNull(); | ||
expect(nameElement.textContent.trim()).not.toBe(''); | ||
|
||
// Get the email element | ||
const emailElement = authorElement.querySelector('email'); | ||
|
||
// Check if the email element exists | ||
expect(emailElement).not.toBeNull(); | ||
|
||
// Check if the email element has the correct text content | ||
expect(emailElement.textContent).not.toBeNull(); | ||
expect(emailElement.textContent.trim()).not.toBe(''); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.