Skip to content

Commit 3f10f15

Browse files
committed
docs: add guides about site search
1 parent 7f4062e commit 3f10f15

File tree

2 files changed

+144
-3
lines changed

2 files changed

+144
-3
lines changed

docs/pages/announcements/pagasa-10day-excel.mdx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ _Note: PAGASA has not announced plans to archive past Excel files._
5151
<details>
5252
<summary>Click to view the attached screenshot of PAGASA's announcement for more information.</summary>
5353
![PAGASA 10-Day Excel files discontinuation announcement](https://firebasestorage.googleapis.com/v0/b/assets-cms.appspot.com/o/users%2FAwryJ0MU8zdxQFh9y0L0x2sSt8z1%2FNOZHqk2E8F8RoVvZuVVv_file?alt=media&token=88bd0b49-b7ee-45f8-843e-11bd0b9dcfe6)
54+
55+
<sup>
56+
[alternate screenshot](https://private-user-images.githubusercontent.com/30580083/481051514-2d333f63-8fc4-4d81-a8da-d0ff48698c5e.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTY1MzczNTAsIm5iZiI6MTc1NjUzNzA1MCwicGF0aCI6Ii8zMDU4MDA4My80ODEwNTE1MTQtMmQzMzNmNjMtOGZjNC00ZDgxLWE4ZGEtZDBmZjQ4Njk4YzVlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA4MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwODMwVDA2NTczMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTVkNDUzZmI0NjVhMTQxOWZhMmUxZDU4YmQ5ZTc1N2EzOGUwMWE1N2VlNWFhNGI3ODA4MTNkZDVmZDg5MjEwYzEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.cUM-tiJyihJq5r8zyiTXW_h3_Astl3obI-XvymTy684)
57+
</sup>
58+
5459
</details>
5560

5661
## FAQs
@@ -79,22 +84,22 @@ PAGASA is modernizing data sharing by moving from Excel files to REST APIs, redu
7984
The new [PAGASA TenDay API](https://tenday.pagasa.dost.gov.ph/docs) (launched July 2025) covers both **10-Day** and **Seasonal weather forecasts**.
8085

8186
<Callout type="info">
82-
It is not yet known whether PAGASA will also discontinue the **Seasonal Weather Forecast Excel files**.
87+
It is not yet known whether PAGASA will also discontinue the [**Seasonal Weather Forecast Excel files**](/post-installation/weather-forecasts/seasonal-forecast/#pagasa-seasonal-weather-forecast-excel-file).
8388
</Callout>
8489
</FAQBox>
8590

8691
<FAQBox title="What you should do">
8792

8893
<Callout type="info">
89-
There are currently no news or directives for syncing the parent **acap-v2** code repository to the **PAGASA TenDay API**. Projects using it as base template (including ACAP Bicol) are advised to sync their ACAPs to the API.
94+
There are currently no news or directives for syncing the parent **acap-v2** code repository to the **PAGASA TenDay API**. Projects using it as base template (including ACAP Bicol) are advised to sync their ACAPs to the API until futher notice.
9095
</Callout>
9196

9297
Here are the recommended migration steps for syncing ACAP to the PAGASA TenDay API. However, <u><i>feel free to adjust and customize as deemed necessary</i></u>.
9398

9499
1. Review the [PAGASA TenDay API documentation](https://tenday.pagasa.dost.gov.ph/docs).
95100
2. Request an **API key** from PAGASA.
96101
3. **Regional location data:** Build the provinces and municipalities list from the PAGASA TenDay API, possibly from its **Validation - Location** endpoint at `"https://tenday.pagasa.dost.gov.ph/api/v1/location"`.
97-
4. **Data source:** Replace the **10-Day weather forecast data** Excel fetch/parse logic with **TenDay API REST responses**.
102+
4. **Data source:** Replace the **10-Day weather forecast Excel file** fetch/parse logic with **TenDay API REST responses**.
98103
5. Update scripts — Excel downloads will stop after August 31, 2025.
99104

100105
<Callout>
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
import { Callout, Steps } from 'nextra/components'
2+
3+
# Search Bar: Site Search
4+
5+
![search bar keywords](https://firebasestorage.googleapis.com/v0/b/assets-cms.appspot.com/o/users%2FAwryJ0MU8zdxQFh9y0L0x2sSt8z1%2FlE08vZGvNmHuOT870iFR_file?alt=media&token=cc3d3bec-739e-4f0d-8a63-8b6b3f0f2891)
6+
7+
## Introduction
8+
9+
This guide shows how to make **new public pages** searchable via the site's **Search Bar** by updating `data.js` and **running a keyword indexer script**. ACAP configures this feature via a script in`/server/src/scripts/page_indexer/`.
10+
11+
<Callout>
12+
**`npm run build:page_index`** indexes keywords from live public pages defined in `data.js` and saves them to the database. It runs automatically after deployment, but you can also run it locally for testing.
13+
</Callout>
14+
15+
<Callout type="info">
16+
**Optional:** Only needed when adding **new public pages** or updating existing ones for search indexing.
17+
18+
> **INFO:** The search method and keyword extraction process are expected to extract keywords only from simple static pages. Pages with longer or complex content may require a different approach.
19+
</Callout>
20+
21+
## Add a Page to Search
22+
23+
(Quick summary)
24+
25+
1. Add `id` attributes to text containers in your page.
26+
2. Update `data.js` with path, name, info, and selectors.
27+
3. Run `npm run build:page_index` locally to test.
28+
4. Commit and push changes.
29+
5. Deploy and verify search results.
30+
31+
## Detailed Steps
32+
33+
<Steps>
34+
35+
### Prepare the new public page for indexing
36+
37+
- Add unique HTML `id` attributes to the container `<div>` of target elements with text content that you'd like to extract keywords from.
38+
- For example, if there is a new **About Us** page:
39+
40+
```jsx copy
41+
return (
42+
<Box id="about-us-content">
43+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor...
44+
</Box>
45+
)
46+
```
47+
48+
### Inspect the public pages file definition
49+
50+
- Open the `"/server/src/scripts/page_indexer/data.js"` file.
51+
- Observe the Object structure of the elements in the `sites[]` array, eg., the entry for the public "Weather Services" page,
52+
53+
```js copy
54+
const sites = [
55+
{
56+
path: 'weather-services',
57+
name: 'ACAP Services',
58+
info: 'Seasonal and 10-Day Weather Forecasts, and Special Weather Advisory',
59+
selectors: [
60+
'#contents-seasonal-forecast',
61+
'#contents-tenday-forecast',
62+
'#contents-special-weather-forecast'
63+
]
64+
},
65+
...
66+
]
67+
```
68+
69+
<details>
70+
<summary>👉 Click to view the **`sites[]` Object key definitions**</summary>
71+
72+
| Key | Definition |
73+
| --- | --- |
74+
| path | Frontend (NextJS) route to the target page |
75+
| name | Page title |
76+
| info | Short summary or description about the page |
77+
| selectors | Array of HTML `id` attributes in the page in which to extract keywords from. Each element starts with a `#` |
78+
79+
</details>
80+
81+
<Callout type="warning">
82+
- Failing to add appropriate `"selectors"` will skip indexing the search keywords.
83+
- Ensure all public pages load correctly. There will be errors in indexing if a page is inaccessible or has loading errors.
84+
</Callout>
85+
86+
### Add a new page file entry
87+
88+
- Create a new entry in the `"/server/src/scripts/page_indexer/data.js"` file under the `sites[]` array corresponding to a newly-created public page.
89+
- For example, to add the **About Us** page from **step #1**:
90+
91+
```js copy
92+
const sites = [
93+
{
94+
path: 'about-us',
95+
name: 'About Us',
96+
info: 'Information and details about our company',
97+
selectors: ['#about-us-content']
98+
},
99+
...
100+
]
101+
102+
### Test extracting keywords
103+
104+
- Set `LIVE_ORIGIN=http://localhost:3000` in the server `.env`
105+
- Run the local website
106+
```sh copy
107+
npm run dev
108+
```
109+
110+
- Open `http://localhost:3000` to verify the site is running.
111+
112+
- Run the server NPM script
113+
```sh copy
114+
npm run build:page_index
115+
```
116+
117+
Fix errors that may occur during this step.
118+
119+
- If there are no errors in the previous step, type keyword(s) from the sample **About Us** page in the **Search Bar**, eg.,
120+
```text copy
121+
lorem ipsum
122+
```
123+
124+
The **About Us** page should display in the search results.
125+
126+
![site search success](https://firebasestorage.googleapis.com/v0/b/assets-cms.appspot.com/o/users%2FAwryJ0MU8zdxQFh9y0L0x2sSt8z1%2FUg972YCHQreS1jQVGmif_file?alt=media&token=55f400fa-cb64-4870-9ee0-5daceb702019)
127+
128+
### Commit the `data.js` file
129+
130+
If there are no errors in the previous steps and the search keyword(s) appear in **step #4**, proceed to commit and push the updated `data.js` file.
131+
132+
### Deploy
133+
134+
When you push changes, GitHub Actions will automatically run `npm run build:page_index` during deployment. Verify that the new keywords appear in the live Search Bar.
135+
136+
</Steps>

0 commit comments

Comments
 (0)