This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-site.git


The following commit(s) were added to refs/heads/master by this push:
     new a942e5ff Show how to filter only some site pages
a942e5ff is described below

commit a942e5ffdf031ed36188b383ac6ff9f9ff83cde0
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Wed Nov 4 09:06:06 2026 +0000

    Show how to filter only some site pages
    
    Adds the generatedSiteDirectory variant to the filtering section of the 
site guide (maven-site-plugin#1003, MSITE-869): no Site Plugin configuration, 
and src/site stays unfiltered.
---
 content/markdown/guides/mini/guide-site.md | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/content/markdown/guides/mini/guide-site.md 
b/content/markdown/guides/mini/guide-site.md
index d5212239..95a14b97 100644
--- a/content/markdown/guides/mini/guide-site.md
+++ b/content/markdown/guides/mini/guide-site.md
@@ -297,6 +297,33 @@ Then generate the site from the filtered sources by 
adjusting the [`siteDirector
 </project>
 ```
 
+To filter only some pages, keep them in a separate directory, such as 
`src/site-filtered`, and copy it with filtering into 
`${project.build.directory}/generated-site` instead. That is the default 
[`generatedSiteDirectory`](/plugins/maven-site-plugin/site-mojo.html#generatedSiteDirectory)
 of the Maven Site Plugin, which renders it together with `src/site`, so the 
plugin needs no configuration and the pages in `src/site` stay unfiltered:
+
+```xml
+<execution>
+  <id>filter-site</id>
+  <phase>pre-site</phase>
+  <goals>
+    <goal>copy-resources</goal>
+  </goals>
+  <configuration>
+    
<outputDirectory>${project.build.directory}/generated-site</outputDirectory>
+    <resources>
+      <resource>
+        <directory>src/site-filtered</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+  </configuration>
+</execution>
+```
+
+With either setup, note the following:
+
+- The `pre-site` phase runs only when you invoke the `site` lifecycle phase, 
as in `mvn site`. A direct call of the goal, `mvn site:site`, skips it.
+- Resource filtering also replaces `@...@` expressions by default. If a page 
contains such text, for example an email address, set 
`<useDefaultDelimiters>false</useDefaultDelimiters>` and declare only the 
delimiters you need.
+- Keep binary files, such as images, out of the filtered directory, or copy 
them with a second `<resource>` without filtering, because filtering can 
corrupt them.
+
 ## Multi-module Sites
 
 Running `mvn site` on a multi-module project builds the site of every module 
individually, and relative links between module sites work only after you stage 
or deploy. See [Building multi-module sites](./guide-multimodule-site.html) for 
staging, deployment, site descriptor inheritance and aggregate reports.

Reply via email to