{"id":18565305,"url":"https://github.com/pelican-plugins/search","last_synced_at":"2025-04-30T14:10:31.493Z","repository":{"id":42224196,"uuid":"428722788","full_name":"pelican-plugins/search","owner":"pelican-plugins","description":"Pelican plugin that adds site search capability","archived":false,"fork":false,"pushed_at":"2024-09-12T11:14:29.000Z","size":41,"stargazers_count":51,"open_issues_count":8,"forks_count":9,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-09T17:52:39.057Z","etag":null,"topics":["pelican","pelican-plugins","search"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pelican-plugins.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"justinmayer","liberapay":"pelican"}},"created_at":"2021-11-16T16:03:37.000Z","updated_at":"2025-02-11T06:31:29.000Z","dependencies_parsed_at":"2024-06-19T23:10:15.039Z","dependency_job_id":"931bbd17-4687-464f-b766-878a4a1e629b","html_url":"https://github.com/pelican-plugins/search","commit_stats":{"total_commits":42,"total_committers":8,"mean_commits":5.25,"dds":0.2142857142857143,"last_synced_commit":"cef2029951c60cbfd6d146b7085946c2b017c108"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pelican-plugins%2Fsearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pelican-plugins%2Fsearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pelican-plugins%2Fsearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pelican-plugins%2Fsearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pelican-plugins","download_url":"https://codeload.github.com/pelican-plugins/search/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243510126,"owners_count":20302294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pelican","pelican-plugins","search"],"created_at":"2024-11-06T22:18:17.565Z","updated_at":"2025-03-14T02:08:25.554Z","avatar_url":"https://github.com/pelican-plugins.png","language":"Python","funding_links":["https://github.com/sponsors/justinmayer","https://liberapay.com/pelican"],"categories":[],"sub_categories":[],"readme":"# Search: A Plugin for Pelican\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/pelican-plugins/search/main.yml?branch=main)](https://github.com/pelican-plugins/search/actions)\n[![PyPI Version](https://img.shields.io/pypi/v/pelican-search)](https://pypi.org/project/pelican-search/)\n[![Downloads](https://img.shields.io/pypi/dm/pelican-search)](https://pypi.org/project/pelican-search/)\n![License](https://img.shields.io/pypi/l/pelican-search?color=blue)\n\nThis plugin generates an index for searching content on a Pelican-powered site.\n\n\n## Why would you want this?\n\nStatic sites are, well, static… and thus usually don’t have an application server component that could be used to power site search functionality. Rather than give up control (and privacy) to third-party search engine corporations, this plugin adds elegant and self-hosted site search capability to your site. Last but not least, searches are **really** fast. 🚀\n\nWant to see just _how_ fast? Try it out for yourself. Following are some sites that use this plugin:\n\n* [Justin Mayer](https://justinmayer.com)\n* [Open Source Alternatives](https://opensourcealternatives.org)\n\n\n## Installation\n\nThis plugin uses [Stork](https://stork-search.net/) to generate a search index. Follow the [Stork installation instructions](https://stork-search.net/docs/install) to install this required command-line tool and ensure it is available within `/usr/local/bin/` or another `$PATH`-accessible location of your choosing. For example, Stork can be installed on macOS (Intel) via:\n\n    export STORKVERSION=\"v1.5.0\"\n    wget -O /usr/local/bin/stork https://files.stork-search.net/releases/$STORKVERSION/stork-macos-10-15\n    chmod +x /usr/local/bin/stork\n\nFor macOS on ARM, install via Homebrew:\n\n    brew install stork-search/stork-tap/stork\n\nConfirm that Stork is properly installed via:\n\n    stork --help\n\nOnce Stork has been successfully installed and tested, this plugin can be installed via:\n\n    python -m pip install pelican-search\n\nIf you are using Pelican 4.5+ with namespace plugins and don’t have a `PLUGINS` setting defined in your configuration, then the Search plugin should be auto-discovered with no further action required. If, on the other hand, you _do_ have a `PLUGINS` setting defined (because you also use legacy plugins or because you want to be able to selectively disable installed plugins), then you must manually add `search` to the `PLUGINS` list, as described in the [Pelican plugins documentation][].\n\n\n## Settings\n\nThis plugin’s behavior can be customized via Pelican settings. Those settings, and their default values, follow below.\n\n### `STORK_INPUT_OPTIONS = {}`\n\nIn addition to plain-text files, Stork can recognize and index HTML and Markdown-formatted content. The default behavior of this plugin is to index generated HTML files, since Stork is good at extracting content from tags, scripts, and styles. But that mode may require a slight theme modification that isn’t necessary when indexing Markdown source (see HTML selector setting below). That said, indexing Markdown means that markup information may not be removed from the indexed content and will thus be visible in the search preview results. With that caveat aside, if you want to index Markdown source content files instead of the generated HTML output, you can set `base_directory` to your content path.\n\nAny other setting then the output path will toggle the plugin to switch to \"source\" mode.\n\n**Example**:\n\n```python\nSTORK_INPUT_OPTIONS = {\n    \"base_directory\" : PATH\n}\n```\n\n#### Stork HTML Selector\n\nBy default, Stork looks for `\u003cmain\u003e[…]\u003c/main\u003e` tags to determine where your main content is located. If such tags do not already exist in your theme’s template files, you can either (1) add `\u003cmain\u003e` tags or (2) change the HTML selector that Stork should look for.\n\nTo use the default `main` selector, in each of your theme’s relevant template files, wrap the content you want to index with `\u003cmain\u003e` tags. For example:\n\n`article.html`:\n\n```jinja\n\u003cmain\u003e\n{{ article.content }}\n\u003c/main\u003e\n```\n\n`page.html`:\n\n```jinja\n\u003cmain\u003e\n{{ page.content }}\n\u003c/main\u003e\n\n```\n\nFor more information, refer to [Stork’s documentation on HTML tag selection](https://stork-search.net/docs/html).\n\n**Example**:\n\nTo set it to a different selector (for example, `primary`), you can set it like this:\n\n```python\nSTORK_INPUT_OPTIONS = {\n    \"html_selector\" : \"primary\"\n}\n```\n\nAdditional [Input Options](https://stork-search.net/docs/config-ref) can be added here as a `dict`.\n\n**Example**:\n\n```python\nSTORK_INPUT_OPTIONS = {\n    \"url_prefix\" : SITEURL\n}\n```\n\n### `STORK_OUTPUT_OPTIONS = {}`\n\n[Output Options](https://stork-search.net/docs/config-ref) can be configured as a `dict`.\nKeep in mind that keys are case-sensitive and must be lower case.\n\n**Example**:\n\n```python\nSTORK_OUTPUT_OPTIONS = {\n    \"debug\" : True\n}\n```\n\n## Static Assets\n\nThere are two options for serving the necessary JavaScript, WebAssembly, and CSS static assets:\n\n1. Use a content delivery network (CDN) to serve Stork’s static assets\n2. Self-host the Stork static assets\n\nThe first option is easier to set up. The second option is provided for folks who prefer to self-host everything. After you have decided which option you prefer, follow the relevant section’s instructions below.\n\n### Static Assets — Option 1: Use CDN\n\n#### CSS\n\nAdd the Stork CSS before the closing `\u003c/head\u003e` tag in your theme’s base template file, such as `base.html`:\n\n```html\n\u003clink rel=\"stylesheet\" href=\"https://files.stork-search.net/basic.css\" /\u003e\n```\n\nIf your theme supports dark mode, you may want to also add Stork’s dark CSS file:\n\n```html\n\u003clink\n    rel=\"stylesheet\"\n    media=\"screen and (prefers-color-scheme: dark)\"\n    href=\"https://files.stork-search.net/dark.css\"\n/\u003e\n```\n\n#### JavaScript\n\nAdd the following script tags to your theme’s base template, just before your closing `\u003c/body\u003e` tag, which will load the most recent Stork module along with the matching WASM binary:\n\n```html\n\u003cscript src=\"https://files.stork-search.net/releases/v1.5.0/stork.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n    stork.register(\"sitesearch\", \"{{ SITEURL }}/search-index.st\");\n\u003c/script\u003e\n```\n\n### Static Assets — Option 2: Self-Host\n\nDownload the Stork JavaScript, WebAssembly, and CSS files and put them in your theme’s respective static asset directories:\n\n```shell\nexport STORKVERSION=\"v1.5.0\"\ncd $YOUR-THEME-DIR\nmkdir -p static/{js,css}\nwget -O static/js/stork.js https://files.stork-search.net/releases/$STORKVERSION/stork.js\nwget -O static/js/stork.js.map https://files.stork-search.net/releases/$STORKVERSION/stork.js.map\nwget -O static/js/stork.wasm https://files.stork-search.net/releases/$STORKVERSION/stork.wasm\nwget -O static/css/stork.css https://files.stork-search.net/basic.css\nwget -O static/css/stork-dark.css https://files.stork-search.net/dark.css\n```\n\n#### CSS\n\nAdd the Stork CSS before the closing `\u003c/head\u003e` tag in your theme’s base template file, such as `base.html`:\n\n```jinja\n\u003clink rel=\"stylesheet\" href=\"{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css/stork.css\"\u003e\n```\n\nIf your theme supports dark mode, you may want to also add Stork’s dark CSS file:\n\n```jinja\n\u003clink rel=\"stylesheet\" media=\"screen and (prefers-color-scheme: dark)\" href=\"{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css/stork-dark.css\"\u003e\n```\n\n#### JavaScript \u0026 WebAssembly\n\nAdd the following script tags to your theme’s base template file, such as `base.html`, just before the closing `\u003c/body\u003e` tag:\n\n```jinja\n\u003cscript src=\"{{ SITEURL }}/{{ THEME_STATIC_DIR }}/js/stork.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n    stork.initialize(\"{{ SITEURL }}/{{ THEME_STATIC_DIR }}/js/stork.wasm\")\n    stork.downloadIndex(\"sitesearch\", \"{{ SITEURL }}/search-index.st\")\n    stork.attach(\"sitesearch\")\n\u003c/script\u003e\n```\n\n### Search Input Form\n\nDecide in which place(s) on your site you want to put your search field, such as your `index.html` template file. Then add the search field to the template:\n\n```html\nSearch: \u003cinput data-stork=\"sitesearch\" /\u003e\n\u003cdiv data-stork=\"sitesearch-output\"\u003e\u003c/div\u003e\n```\n\nFor more information regarding this topic, see the [Stork search interface documentation](https://stork-search.net/docs/interface).\n\n\n## Deployment\n\nEnsure your production web server serves the WebAssembly file with the `application/wasm` MIME type. For folks using older versions of Nginx, that might look like the following:\n\n```nginx\n…\nhttp {\n    …\n    include             mime.types;\n    # Types not included in older Nginx versions:\n    types {\n        application/wasm                                 wasm;\n    }\n    …\n}\n```\n\nFor other self-hosting considerations, see the [Stork self-hosting documentation](https://stork-search.net/docs/self-hosting).\n\n\n## Contributing\n\nContributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation, adding missing features, and fixing bugs. You can also help out by reviewing and commenting on [existing issues][].\n\nTo start contributing to this plugin, review the [Contributing to Pelican][] documentation, beginning with the **Contributing Code** section.\n\n## License\n\nThis project is licensed under the AGPL 3.0 license.\n\n[Pelican plugins documentation]: https://docs.getpelican.com/en/latest/plugins.html\n[existing issues]: https://github.com/pelican-plugins/search/issues\n[Contributing to Pelican]: https://docs.getpelican.com/en/latest/contribute.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpelican-plugins%2Fsearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpelican-plugins%2Fsearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpelican-plugins%2Fsearch/lists"}