https://github.com/devidw/hugo-theme-component-search

Make your hugo blog posts searchable.

https://github.com/devidw/hugo-theme-component-search

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.9%) to scientific vocabulary

Keywords

hugo-search hugo-theme-component search
Last synced: 6 months ago · JSON representation

Repository

Make your hugo blog posts searchable.

Basic Info
  • Host: GitHub
  • Owner: devidw
  • License: mit
  • Default Branch: master
  • Homepage:
  • Size: 6.84 KB
Statistics
  • Stars: 4
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
hugo-search hugo-theme-component search
Created about 4 years ago · Last pushed about 4 years ago
Metadata Files
Readme License

README.adoc

= Search

Make your hugo blog searchable by simply search for blog posts in the auto-generated RSS feed file `index.xml`. 

No need to generate extra `.json` search index files.

Since the theme component looks for the RSS feed file, make sure you have it available in your builded site.

== Installation

=== 1. Add submodule

Clone this theme component to your project's `themes` directory:

[source,cmd]
----
git submodule add https://github.com/devidw/hugo-theme-component-search ./themes/hugo-theme-component-search
----


=== 2. Add config

Add this theme component to your list of themes inside your project's `config` file (either `.yaml`, `.toml` or `.json`):

|===
| Format | Syntax

| `config.yaml`
a|
[source,yaml]
----
theme: 
  - "…"
  - "hugo-theme-component-search"
  - "…"
----

| `config.toml`
a| [source,toml]
----
theme = ["…", "hugo-theme-component-search", "…"]
----

| `config.json`
a| [source,json]
----
"theme": ["…", "hugo-theme-component-search", "…"]
----
|===



=== 3. Embed theme component


==== Partial(s)

Include the available theme component partial(s) in your theme's template file(s):

[source,html]
----


{{ if templates.Exists "partials/vendor/devidw/search/include.html" }}
    {{ partial "vendor/devidw/search/include.html" . }}
{{ end }}


----


== Examples

=== Standalone search page

You can embed the partial everywhere you want in to appear on your site.

If you want to have a standalone search page, you can create a page template for your search page. 

To do so, create a `search/single.html` template file in your theme's `layouts/` directory.

NOTE: `search` can be any name you want.

Inside the template file, include the partial as mentioned above.

You propably want to wrap the partial inside a block definition block to extend your main layout:

[source,html]
----
{{define "main"}}
  {{ if templates.Exists "partials/vendor/devidw/search/include.html" }}
    {{ partial "vendor/devidw/search/include.html" . }}
  {{ end }}
{{ end }}
----

NOTE: Make sure to adjust the block name to your needs, if you main block is not named `main`.

When you have set up the template file, you can create the actual search page by creating a `search.adoc` file in your `content/` directory.

NOTE: `search.adoc` can be any valid hugo content file name. For example, `search.md` or `search.html` are just fine as well.

Add the following frontmatter to your `search.adoc` file:

[source,yaml]
----
title: "Search"
description: "Quickly find what you are looking for."
type: "search"
# ...
----

NOTE: The `type` frontmatter is important. It is used to determine the page type. Any other frontmatter can be specified as you wish.

You should now have a standalone search page accessible under the address based on your permalink settings.

***

_This https://gohugo.io/hugo-modules/theme-components/[hugo theme component] was scaffolded with the https://github.com/devidw/cookiecutter-hugo-theme-component[cookiecutter-hugo-theme-component] template._

Owner

  • Name: David Wolf
  • Login: devidw
  • Kind: user
  • Location: The Zone

// uncommenting

GitHub Events

Total
Last Year

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 3
  • Total Committers: 1
  • Avg Commits per committer: 3.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
David Wolf 6****w 3

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels