Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/chipzoller/hugo-clarity.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/ISSUE_TEMPLATE/01-bug_report.yml119
-rw-r--r--.github/ISSUE_TEMPLATE/02-feature_request.yml67
-rw-r--r--.github/ISSUE_TEMPLATE/03-docs_update.yml19
-rw-r--r--.github/ISSUE_TEMPLATE/bug_report.md25
-rw-r--r--.github/ISSUE_TEMPLATE/config.yml17
-rw-r--r--.github/pull-request_template.md38
-rw-r--r--CODE_OF_CONDUCT.md78
-rw-r--r--CONTRIBUTING.md115
-rw-r--r--README.md37
-rw-r--r--assets/js/functions.js9
-rw-r--r--assets/js/search.js54
-rw-r--r--exampleSite/config/_default/params.toml10
-rw-r--r--layouts/partials/archive.html7
-rw-r--r--layouts/partials/sidebar.html15
14 files changed, 532 insertions, 78 deletions
diff --git a/.github/ISSUE_TEMPLATE/01-bug_report.yml b/.github/ISSUE_TEMPLATE/01-bug_report.yml
new file mode 100644
index 0000000..252f108
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/01-bug_report.yml
@@ -0,0 +1,119 @@
+name: Bug report
+description: Something isn't working correctly with the theme.
+title: "[Bug] "
+labels: ["bug"]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Before opening a bug report, please search for the behavior in the [existing issues](https://github.com/chipzoller/hugo-clarity/issues).
+
+ If you have a question, please use [GitHub Discussions](https://github.com/chipzoller/hugo-clarity/discussions) rather than posting an issue.
+
+ ---
+
+ Thank you for taking the time to file a bug report! To address this bug as fast as possible, we need some information.
+ - type: checkboxes
+ id: confirm_prereqs
+ attributes:
+ label: "I confirm:"
+ options:
+ - label: "I am running the [extended version of Hugo version 0.91.0 or above](https://github.com/chipzoller/hugo-clarity/blob/master/README.md#prerequisites) to build my site."
+ required: true
+ - label: "I have read the [Hugo Clarity theme documentation](https://github.com/chipzoller/hugo-clarity/blob/master/README.md)."
+ required: true
+ - label: "I have used the [example site's config files](https://github.com/chipzoller/hugo-clarity/tree/master/exampleSite/config/_default) as reference."
+ required: true
+ - label: "I have reviewed [other issues in this repository](https://github.com/chipzoller/hugo-clarity/issues) and mine is not recorded."
+ required: true
+ - type: input
+ id: v_hugo
+ attributes:
+ label: Hugo version
+ description: 'Run `hugo version` and paste the output here.'
+ validations:
+ required: true
+ - type: dropdown
+ id: bug_location
+ attributes:
+ label: Where is this bug showing up?
+ options:
+ - "On the command line: Hugo won't build the site and shows warnings or errors."
+ - "In the browser: Hugo builds the site, but something doesn't look right."
+ - "Other: Both, neither, or somewhere else."
+ validations:
+ required: true
+ - type: input
+ id: os
+ attributes:
+ label: Operating system
+ description:
+ For example, iOS 14, Windows 10, macOS 12.5, Linux Ubuntu 22.04, Android
+ 12, etc.
+ validations:
+ required: true
+ - type: input
+ id: browser
+ attributes:
+ label: Browser (if applicable)
+ description: For example, Chrome 76, Safari 13, etc.
+ - type: textarea
+ id: current_behavior
+ attributes:
+ label: Current behavior
+ description:
+ Describe how the bug shows up. You can also provide a link to a repo
+ or a live website, or include screenshots.
+ validations:
+ required: true
+ - type: textarea
+ id: expected_behavior
+ attributes:
+ label: Expected behavior
+ description: Describe what you expect the behavior to be without the bug.
+ validations:
+ required: true
+ - type: textarea
+ id: steps_to_reproduce
+ attributes:
+ label: Steps to reproduce
+ description: Explain the steps required to duplicate the bug.
+ validations:
+ required: true
+ - type: textarea
+ id: logs
+ attributes:
+ label: Relevant log output
+ description:
+ If applicable, provide any errors, stacktraces or other output from
+ Hugo.
+ render: shell
+ - type: textarea
+ id: related_code
+ attributes:
+ label: Related code
+ description:
+ If you have already identified the file or lines in the existing code
+ that may be relevant to this bug, providing them will help speed up
+ our response.
+ - type: textarea
+ id: solution
+ attributes:
+ label: Preferred solution
+ description:
+ If you have a suggested technical solution to this bug, please describe
+ it here.
+ - type: textarea
+ id: other_info
+ attributes:
+ label: Other information
+ description:
+ Any other information that might be relevant to this bug. Do you know on
+ what date or git commit this bug might have appeared? If so, please let
+ us know!
+ - type: markdown
+ attributes:
+ value: |
+ ---
+
+ **Thank you!**
diff --git a/.github/ISSUE_TEMPLATE/02-feature_request.yml b/.github/ISSUE_TEMPLATE/02-feature_request.yml
new file mode 100644
index 0000000..2a8b508
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/02-feature_request.yml
@@ -0,0 +1,67 @@
+name: Feature request
+description: Suggest a new feature for the theme.
+title: "[Feature] "
+labels: ["enhancement"]
+body:
+ - type: checkboxes
+ id: confirm_prereqs
+ attributes:
+ label: "I confirm:"
+ options:
+ - label: "I have read the [Hugo Clarity theme documentation](https://github.com/chipzoller/hugo-clarity/blob/master/README.md)."
+ required: true
+ - label: "I have reviewed [other issues in this repository](https://github.com/chipzoller/hugo-clarity/issues), and this feature has not already been requested."
+ required: true
+ - type: checkboxes
+ id: feature_type
+ attributes:
+ label: Type of feature (check all that apply)
+ options:
+ - label: Site functionality
+ - label: Design (styling)
+ - label: Site performance
+ - label: Accessibility
+ - label: Translations and internationalization (i18n)
+ - label: Code improvements
+ - label: Other (please describe below)
+ - type: textarea
+ id: feature_description
+ attributes:
+ label: Describe the feature
+ description:
+ A clear and concise description of your feature request. Please note if
+ your request is related to a problem or existing bug.
+ validations:
+ required: true
+ - type: textarea
+ id: solution
+ attributes:
+ label: Preferred solution
+ description:
+ If you have a specific way to implement this feature, please describe
+ it here.
+ validations:
+ required: false
+ - type: textarea
+ id: alternatives
+ attributes:
+ label: Alternatives
+ description: Any alternatives you've considered.
+ validations:
+ required: false
+ - type: textarea
+ id: context
+ attributes:
+ label: Additional Context
+ description:
+ This could include examples of this feature in websites or other Hugo
+ themes, links to blog posts or other documentation of this feature or
+ why it would be a useful addition, use cases or problem statements, etc.
+ validations:
+ required: false
+ - type: markdown
+ attributes:
+ value: |
+ ---
+
+ **Thank you!**
diff --git a/.github/ISSUE_TEMPLATE/03-docs_update.yml b/.github/ISSUE_TEMPLATE/03-docs_update.yml
new file mode 100644
index 0000000..32b67e8
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/03-docs_update.yml
@@ -0,0 +1,19 @@
+name: Documentation change
+description: Suggest a change to theme documentation.
+title: "[Docs] "
+labels: ["documentation"]
+body:
+ - type: textarea
+ id: description
+ attributes:
+ label: Describe the change
+ description:
+ Summarize your suggested changes to the documentation.
+ validations:
+ required: true
+ - type: markdown
+ attributes:
+ value: |
+ ---
+
+ **Thank you!**
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
deleted file mode 100644
index 94685da..0000000
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ /dev/null
@@ -1,25 +0,0 @@
----
-name: Bug report
-about: Report an issue to help us improve the theme
-title: ''
-labels: ''
-assignees: ''
-
----
-
-**I have checked all the prerequisites below and I'm yet experiencing a problem**
-
-- [ ] Read the README.md
-- [ ] Have the extended version of Hugo installed
-- [ ] Used the exampleSite's config.toml as a reference
-- [ ] I have included my repository link. Instead of pasting long snippets here.
-
-**Describe the bug**
-
-A clear and CONCISE description of what the bug is. [REPLACE]
-
-> Avoid long-winded descriptions
-
-**Desktop (please complete the following information):**
- - OS: [e.g. iOS 14, Windows 10]
- - Browser [e.g. chrome 76, safari 13]
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 0000000..f731a2d
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,17 @@
+blank_issues_enabled: false
+contact_links:
+ - name: Ask questions and get support
+ url: https://github.com/chipzoller/hugo-clarity/discussions
+ about:
+ If you have a question, want general support that isn't about a bug in the
+ theme, or want to discuss new ideas without making a specific feature
+ request, please use GitHub Discussions. This keeps our issue queue focused
+ on actionable items. Thanks!
+ - name: Read Hugo Clarity documentation
+ url: https://github.com/chipzoller/hugo-clarity/blob/master/README.md
+ about:
+ If you're new to Hugo Clarity, check our docs for configuration details and
+ other information.
+ - name: Theme contribution guide
+ url: https://github.com/chipzoller/hugo-clarity/blob/master/CONTRIBUTING.md
+ about: Help us make this theme great!
diff --git a/.github/pull-request_template.md b/.github/pull-request_template.md
index f605cca..531633f 100644
--- a/.github/pull-request_template.md
+++ b/.github/pull-request_template.md
@@ -1,17 +1,37 @@
-This PR...
-## Changes / fixes
--
+<!--- Please provide a general summary of your changes in the title above. If GitHub has inserted "Signed-off-by" you can remove it if you like. -->
-## Screenshots (if applicable)
+## Pull Request type
-(prefer animated gif)
+<!-- To ensure we're able to review your PR quickly, limit your pull request to one type of change. Submit multiple pull requests if needed. -->
+
+Please check the type of change your PR introduces:
+
+- [ ] Bug-fix
+- [ ] Feature (functionality, design, translations, etc.)
+- [ ] Documentation change
+- [ ] Project management (tests, CI, GitHub configuration, etc.)
+- [ ] Other (please describe):
+
+## Current state
+
+<!-- Please describe the current behavior, content, or docs that you are modifying -- or link to relevant issue(s). -->
+
+Issue Number(s):
+
+## Proposed changes
+
+<!-- Please describe the changes this PR makes. -->
+
+## Screenshots, if applicable
+
+<!-- For visual changes to the theme, this is required. -->
## Checklist
-_Ensure you have checked off the following before submitting your PR._
+<!-- Ensure you've completed the following items, as appropriate, before submitting your PR. -->
-- [ ] tested locally with the [latest release of Hugo](https://github.com/gohugoio/hugo/releases). This requirement is [a standard](https://github.com/gohugoio/hugoThemes#theme-maintenance)
-- [ ] added new dependencies
-- [ ] updated the [docs]() ⚠️
+- [ ] **Bug-fixes and new features:** I have tested locally with the [latest release of Hugo extended](https://github.com/gohugoio/hugo/releases). This requirement is [a standard](https://github.com/gohugoio/hugoThemes#theme-maintenance).
+- [ ] **Bug-fixes, new features, and doc changes:** I have updated the relevant documentation as part of this PR.
+- [ ] **All PRs:** I have [signed off](https://github.com/chipzoller/hugo-clarity/blob/master/CONTRIBUTING.md#how-to-submit-a-pull-request) (using `git commit -s ...`), or if not possible due to developer environment constraints, will comment below confirming that I am adhering to the [Developer Certificate of Origin](https://probot.github.io/apps/dco/).
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..85c227a
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,78 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to make participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, sex characteristics, gender identity and expression,
+level of experience, education, socio-economic status, nationality, personal
+appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+ advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies within all project spaces, and it also applies when
+an individual is representing the project or its community in public spaces.
+Examples of representing a project or community include using an official
+project e-mail address, posting via an official social media account, or acting
+as an appointed representative at an online or offline event. Representation of
+a project may be further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting project lead Chip Zoller via
+[GitHub](https://github.com/chipzoller),
+[Twitter](https://twitter.com/chipzoller) or
+[LinkedIn](https://www.linkedin.com/in/chipzoller). All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the
+[Contributor Covenant](https://www.contributor-covenant.org/), version 1.4,
+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+
+For answers to common questions about this code of conduct, see
+https://www.contributor-covenant.org/faq
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..885456f
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,115 @@
+# Contributing to Hugo Clarity
+
+Thank you for taking the time to contribute!
+
+Hugo Clarity is
+[open-source](https://github.com/chipzoller/hugo-clarity/blob/master/LICENSE.md),
+and contributions are what make the open-source community such an amazing place
+to learn, inspire, and create. Any contributions you make will benefit others,
+and are **greatly appreciated**!
+
+When contributing, especially for the first time, consider starting by
+[creating an issue](https://github.com/chipzoller/hugo-clarity/issues/new/choose)
+so you can get feedback from the maintainers and avoid unncessary work.
+
+**Note:** Hugo Clarity has a [code of conduct](CODE_OF_CONDUCT.md).
+Please follow it in all your interactions with the project.
+
+## Getting support and asking questions
+
+If you have questions about the project, are encountering something and aren't
+sure if it's a bug, or if you'd like to discuss an idea before filing a feature
+request, please use
+[GitHub Discussions](https://github.com/chipzoller/hugo-clarity/discussions)
+rather than posting an issue.
+
+## Filing issues and requesting features
+
+You've found a bug in the source code, a mistake in the documentation or maybe
+you'd like a new feature? You can help us by
+[submitting an issue](https://github.com/chipzoller/hugo-clarity/issues/new/choose).
+Before you create an issue, make sure to
+[search the current issues](https://github.com/chipzoller/hugo-clarity/issues)
+-- your issue may have already been addressed!
+
+Once a bug has been confirmed or a feature has been approved, you are welcome
+to [submit a Pull Request](#how-to-submit-a-pull-request) -- if you have the
+solution, please do tell us about it!
+
+### Helping us fix bugs
+
+We want to help you solve any problems you might be facing with the theme! In
+order to help us help you, create bug reports that are:
+
+- _Reproducible._ Include steps to reproduce the problem.
+- _Specific._ Include as much detail as possible: which version, what
+ environment, etc.
+- _Unique._ If other bug reports already exist about the same issue, add to
+ them rather than creating a new one.
+- _Scoped to a single bug._ One bug per report. We know this might be a little
+ tedious, but it makes it *much* easier to keep track of which bugs are fixed
+ and which still need work to be done.
+
+## How to submit a Pull Request
+
+1. Search our repository for open or closed
+ [Pull Requests](https://github.com/chipzoller/hugo-clarity/pulls?q=is%3Apr+sort%3Aupdated-desc)
+ that relate to your issue. You don't want to duplicate effort, and if one
+ already exists you can collaborate on that.
+
+2. Ensure that you plan to work consistent with the
+ [Developer Certificate of Origin](https://developercertificate.org/). This
+ confirms to us that you have the right to submit your contribution to an
+ open-source project (i.e. it is not proprietary or trade-secret code) and
+ that the record of your contribution will be recorded. **This is required
+ in order to contribute to Hugo Clarity**, and you'll need to confirm your
+ consent when committing, as shown below.
+
+3. [Fork the project](https://docs.github.com/en/get-started/quickstart/fork-a-repo),
+ then checkout your fork using
+ [Gitpod](https://github.com/chipzoller/hugo-clarity/blob/master/README.md#option-1a-development-in-the-browser)
+ or
+ [locally on your machine](https://github.com/chipzoller/hugo-clarity/blob/master/README.md#option-1b-development-on-your-machine)
+
+4. Create a new branch:
+
+ ```sh
+ git checkout -b amazing_feature
+ ```
+
+5. Do your work.
+
+6. Commit your changes:
+
+ ```sh
+ git commit -s -m 'Adding an amazing new feature'
+ ```
+
+ The `-s` flag is the short form of `--signoff` and signals to us that you are
+ abiding by the [Developer Certificate of Origin](https://developercertificate.org/) (see step 2, above).
+
+ If you are in an environment in which you cannot provide this cryptographic
+ signoff (for instance, Gitpod) you will need to leave a comment on the PR you
+ submit confirming that you certify compliance with the DCO.
+
+7. Repeat steps 5-6 as necessary.
+
+8. Unless your PR is documentation-only, **test your work
+ [using Hugo extended](https://github.com/chipzoller/hugo-clarity/blob/master/README.md#prerequisites)
+ to build a site.** When you submit your PR we'll run test-builds of a Hugo
+ site with your PR applied, so you'll save time if you fix any build issues
+ before submitting.
+
+9. Push the branch:
+
+ ```sh
+ git push origin amazing_feature
+ ```
+
+10. [Open a Pull Request](https://github.com/chipzoller/hugo-clarity/compare?expand=1)
+ by
+ "[comparing across forks](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)"
+ and filling out the form. Completing the PR template as requested will ensure
+ your work gets reviewed by maintainers promptly.
+
+## 🎉 **Thank you for your contribution!**
diff --git a/README.md b/README.md
index c938961..f0619fc 100644
--- a/README.md
+++ b/README.md
@@ -46,6 +46,7 @@ A technology-minded theme for Hugo based on VMware's open-source [Clarity Design
* [Logo alignment](#logo-alignment)
* [Code](#code)
* [Table of contents](#table-of-contents-1)
+ * [Pinning featured posts](#pinning-featured-posts)
* [Notices](#notices)
* [Custom CSS and JS](#custom-css-and-js)
* [Custom Site Disclaimer](#site-disclaimer)
@@ -56,6 +57,9 @@ A technology-minded theme for Hugo based on VMware's open-source [Clarity Design
* [Math notation](#math-notation)
* [Open Street Map](#map)
* [Search](#search)
+* [Contributing](#contributing)
+* [Code of conduct](#code-of-conduct)
+* [License](#license)
## Features
@@ -119,7 +123,7 @@ There are several ways to use this theme:
For trying out the theme, quick experimentation, and to contribute Pull Requests, Gitpod is the easiest option. Use the button above and it will spin up a prebuilt environment with a site ready to go.
-If you want to contribute a PR, [this is a good overview of that process](https://jldec.me/using-gitpod-to-create-a-pr), and there's also an [optional browser extension](https://www.gitpod.io/docs/browser-extension).
+If you want to contribute a PR, [this is a good overview of that process](https://jldec.me/using-gitpod-to-create-a-pr), and there's also an [optional browser extension](https://www.gitpod.io/docs/browser-extension). [Read more about contributing to Hugo Clarity](CONTRIBUTING.md)
### Option 1b: Development on your machine
@@ -133,6 +137,8 @@ hugo server --themesDir ../..
> Note that while this is a good way to work on Hugo Clarity, isn't a good way to work on your own site, since it uses the content from `exampleSite`, and wouldn't be aware of any overrides your site might apply to the theme.
+[Read more about contributing to Hugo Clarity](CONTRIBUTING.md)
+
### Option 2: Hugo modules
This option arguably requires the least effort to run and maintain your website with the Hugo Clarity theme.
@@ -235,6 +241,8 @@ These options set global values that some pages or all pages in the site use by
| comments | boolean | yes |
| numberOfRecentPosts | integer | no |
| numberOfFeaturedPosts | integer | no |
+| pinFeatured | boolean | no |
+| numberOfPinnedPosts | integer | no |
| dateFormat | string | no |
| enableMathNotation | boolean | yes |
| customFonts | boolean | no |
@@ -325,10 +333,9 @@ If using Matomo Analytics, configure the `matomo_analytics` global parameters in
### Blog directory
-Edit `config.toml` and change the `mainSections` key. Values will be directories where the blogs reside.
+Edit `params.toml` and change the `mainSections` key. Values will be directories where the blogs reside.
```yaml
-[params]
...
mainSections = ["posts", "docs", "blogs"]
...
@@ -641,6 +648,12 @@ Each article can optionally have a table of contents (TOC) generated for it base
![Article table of contents](https://github.com/chipzoller/hugo-clarity/blob/master/images/article-toc.png)
+### Pinning featured posts
+
+This allows you to show the featured posts at the top of the post list.
+
+Use the [site configuration option](#global-parameters) `pinFeatured` to enable/disable it, and the option `numberOfPinnedPosts` to control how many posts to be pinned.
+
### Custom CSS and JS
To minimize HTTP requests per page, we would recommend loading CSS styles and JavaScript helpers in single bundles. That is to say, one CSS file and one JavaScript file. Using Hugo minify functions, these files will be minified to optimize the size.
@@ -798,13 +811,13 @@ You can override these setting from each post individually. For example, you may
If you wish use [Utterances](https://github.com/utterance/utterances) comments on your site, you'll need to perform the following:
- * Ensure you have a GitHub public repository, which you've granted permissions to the [Utterances GitHub App](https://github.com/apps/utterances).
+ * Ensure you have a GitHub public repository, which you've granted permissions to the [Utterances GitHub App](https://github.com/apps/utterances).
* Comment out the line for `disqusShortname = ""` in the `/config/_default/config.toml` file.
* Set `comments = true` in the `/config/_default/params.toml` file.
* Configure the utterances parameters in the `/config/_default/params.toml` file.
Utterances is loaded in the `comments.html` partial by referring to the `utterances.html` partial. Since `single.html` layout loads comments if comments are enabled, you must ensure *both* the `comments` and `utterances` parameters are configured.
-
+
@@ -857,7 +870,7 @@ The site configuration option `showRelatedInArticle` controls if this option is
Likewise, the site configuration option `showRelatedInSidebar` controls if related content is shown on the sidebar. There is no corresponding option within a post to disable this.
-### Map
+### Maps
#### Creating and including a map
@@ -925,3 +938,15 @@ __Search Scope__
- Searching outside a section will search the entire site.
For example, with the above setup, searching from the homepage will produce results from the entire site.
+
+## Contributing
+
+Please read our [contribution guidelines](CONTRIBUTING.md), and thank you for being involved!
+
+## Code of conduct
+
+Hugo Clarity has a [code of conduct](CODE_OF_CONDUCT.md). Please follow it in all your interactions with the project.
+
+## License
+
+Hugo Clarity is open-sourced under the [MIT license](https://github.com/chipzoller/hugo-clarity/blob/master/LICENSE.md). \ No newline at end of file
diff --git a/assets/js/functions.js b/assets/js/functions.js
index 5c7d915..59b9e79 100644
--- a/assets/js/functions.js
+++ b/assets/js/functions.js
@@ -186,6 +186,15 @@ function forEach(node, callback) {
node ? Array.prototype.forEach.call(node.childNodes, callback) : false;
}
+function findQuery(query = 'query') {
+ const urlParams = new URLSearchParams(window.location.search);
+ if(urlParams.has(query)){
+ let c = urlParams.get(query);
+ return c;
+ }
+ return "";
+}
+
function wrapText(text, context, wrapper = 'mark') {
let open = `<${wrapper}>`;
let close = `</${wrapper}>`;
diff --git a/assets/js/search.js b/assets/js/search.js
index 13727a3..c3c926a 100644
--- a/assets/js/search.js
+++ b/assets/js/search.js
@@ -130,15 +130,6 @@ function initializeSearch(index) {
}
}
- function findQuery(query = 'query') {
- const urlParams = new URLSearchParams(window.location.search);
- if(urlParams.has(query)){
- let c = urlParams.get(query);
- return c;
- }
- return "";
- }
-
function passiveSearch() {
if(searchPageElement) {
const searchTerm = findQuery();
@@ -208,27 +199,32 @@ function initializeSearch(index) {
}
function highlightSearchTerms(search, context, wrapper = 'mark', cssClass = '') {
- let container = elem(context);
- let reg = new RegExp("(" + search + ")", "gi");
-
- function searchInNode(parentNode, search) {
- forEach(parentNode, function (node) {
- if (node.nodeType === 1) {
- searchInNode(node, search);
- } else if (
- node.nodeType === 3 &&
- reg.test(node.nodeValue)
- ) {
- let string = node.nodeValue.replace(reg, `<${wrapper} class="${cssClass}">$1</${wrapper}>`);
- let span = document.createElement("span");
- span.dataset.searched = "true";
- span.innerHTML = string;
- parentNode.replaceChild(span, node);
- }
- });
- };
+ const query = findQuery()
+ if(query){
+
+ let container = elem(context);
+ let reg = new RegExp("(" + search + ")", "gi");
+
+ function searchInNode(parentNode, search) {
+ forEach(parentNode, function (node) {
+ if (node.nodeType === 1) {
+ searchInNode(node, search);
+ } else if (
+ node.nodeType === 3 &&
+ reg.test(node.nodeValue)
+ ) {
+ let string = node.nodeValue.replace(reg, `<${wrapper} class="${cssClass}">$1</${wrapper}>`);
+ let span = document.createElement("span");
+ span.dataset.searched = "true";
+ span.innerHTML = string;
+ parentNode.replaceChild(span, node);
+ }
+ });
+ };
- searchInNode(container, search);
+ searchInNode(container, search);
+
+ }
}
window.addEventListener('load', function() {
diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml
index 2ba2b67..8e02001 100644
--- a/exampleSite/config/_default/params.toml
+++ b/exampleSite/config/_default/params.toml
@@ -105,12 +105,18 @@ languageMenuName = "🌐"
# utterancesTheme = "github-light" # Default: github-dark
# utterancesIssueTerm = "pathname" # Default: pathname
-# Maximum number of recent posts.
+# Maximum number of recent posts. (default: 8)
# numberOfRecentPosts = 8
-# Maximum number of featured posts.
+# Maximum number of featured posts. (default: 8)
# numberOfFeaturedPosts = 8
+# Pin featured posts in list.
+# pinFeatured = true
+
+# Maximum number of pinned featured posts. (default: 8)
+# numberOfPinnedPosts = 8
+
# Date format. Checkout https://gohugo.io/functions/format/#hugo-date-and-time-templating-reference for details.
# dateFormat = "2006-01-02" # Default to "Jan 2, 2006".
# customFonts = false # toggle to true if you want to use custom fonts only.
diff --git a/layouts/partials/archive.html b/layouts/partials/archive.html
index 2ba56e4..9f02449 100644
--- a/layouts/partials/archive.html
+++ b/layouts/partials/archive.html
@@ -2,6 +2,13 @@
{{ if .IsHome }}
{{ $pages = where site.RegularPages "Type" "in" site.Params.mainSections }}
{{ end }}
+
+{{ if eq site.Params.pinFeatured true }}
+ {{ $featured := default 8 site.Params.numberOfPinnedPosts }}
+ {{ $featuredPosts := first $featured (where $pages "Params.featured" true)}}
+ {{ $normalPosts := $pages | symdiff $featuredPosts }}
+ {{ $pages = $featuredPosts | append $normalPosts }}
+{{ end }}
<div class="grid-inverse wrap content">
<div>
<ul class="posts" id="posts">
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html
index 30fd676..17b18b2 100644
--- a/layouts/partials/sidebar.html
+++ b/layouts/partials/sidebar.html
@@ -34,11 +34,11 @@
{{- end }}
{{ if .Site.Params.sidebardisclaimer }}
- <div class="sidebardisclaimer">
- <h2 class="mt-4">Disclaimer</h2>
+ <div class="sidebardisclaimer">
+ <h2 class="mt-4">Disclaimer</h2>
{{ .Site.Params.disclaimerText }}
- </div>
- {{ end }}
+ </div>
+ {{ end }}
{{- $relatedInSidebar := true }}
{{- if eq $s.showRelatedInSidebar false }}
@@ -56,9 +56,10 @@
</ul>
{{ end }}
- {{- $posts := where (where .Site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" $s.mainSections }}
+ {{- $posts := where .Site.RegularPages "Type" "in" $s.mainSections }}
{{- $featured := default 8 $s.numberOfFeaturedPosts }}
- {{- with first $featured (where $posts "Params.featured" true)}}
+ {{- $featuredPosts := first $featured (where $posts "Params.featured" true)}}
+ {{- with $featuredPosts }}
<h2 class="mt-4">{{ T "featured_posts" }}</h2>
<ul>
{{- range . }}
@@ -71,7 +72,7 @@
<h2 class="mt-4">{{ T "recent_posts" }}</h2>
<ul class="flex-column">
{{- $recent := default 8 $s.numberOfRecentPosts }}
- {{- range first $recent $posts }}
+ {{- range first $recent $posts | symdiff $featuredPosts }}
<li>
<a href="{{ .Permalink }}" class="nav-link" title="{{ .Title }}">{{ .Title | markdownify }}</a>
</li>