-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Thorsten Marx
committed
Dec 3, 2023
1 parent
3d2c922
commit b1ea159
Showing
11 changed files
with
103 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"modules":{"flexmark-module":{"active":false,"id":"flexmark-module","moduleDir":"flexmark-module"},"thymeleaf-module":{"active":true,"id":"thymeleaf-module","moduleDir":"thymeleaf-module"},"freemarker-module":{"active":false,"id":"freemarker-module","moduleDir":"freemarker-module"},"pug-module":{"active":false,"id":"pug-module","moduleDir":"pug-module"},"search-module":{"active":true,"id":"search-module","moduleDir":"search-module"},"pebble-module":{"active":false,"id":"pebble-module","moduleDir":"pebble-module"},"example-module":{"active":true,"id":"example-module","moduleDir":"example-module"},"markedjs-module":{"active":true,"id":"markedjs-module","moduleDir":"markedjs-module"}}} | ||
{"modules":{"flexmark-module":{"active":false,"id":"flexmark-module","moduleDir":"flexmark-module"},"thymeleaf-module":{"active":true,"id":"thymeleaf-module","moduleDir":"thymeleaf-module"},"freemarker-module":{"active":false,"id":"freemarker-module","moduleDir":"freemarker-module"},"pug-module":{"active":false,"id":"pug-module","moduleDir":"pug-module"},"search-module":{"active":true,"id":"search-module","moduleDir":"search-module"},"pebble-module":{"active":false,"id":"pebble-module","moduleDir":"pebble-module"},"seo-module":{"active":true,"id":"seo-module","moduleDir":"seo-module"},"example-module":{"active":true,"id":"example-module","moduleDir":"example-module"},"markedjs-module":{"active":true,"id":"markedjs-module","moduleDir":"markedjs-module"}}} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ theme: default | |
modules: | ||
active: | ||
- markedjs-module | ||
- seo-module | ||
media: | ||
formats: | ||
- name: small | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"modules":{"flexmark-module":{"active":false,"id":"flexmark-module","moduleDir":"flexmark-module"},"thymeleaf-module":{"active":false,"id":"thymeleaf-module","moduleDir":"thymeleaf-module"},"freemarker-module":{"active":false,"id":"freemarker-module","moduleDir":"freemarker-module"},"pug-module":{"active":false,"id":"pug-module","moduleDir":"pug-module"},"search-module":{"active":false,"id":"search-module","moduleDir":"search-module"},"pebble-module":{"active":true,"id":"pebble-module","moduleDir":"pebble-module"},"example-module":{"active":false,"id":"example-module","moduleDir":"example-module"},"markedjs-module":{"active":true,"id":"markedjs-module","moduleDir":"markedjs-module"}}} | ||
{"modules":{"flexmark-module":{"active":false,"id":"flexmark-module","moduleDir":"flexmark-module"},"thymeleaf-module":{"active":false,"id":"thymeleaf-module","moduleDir":"thymeleaf-module"},"freemarker-module":{"active":false,"id":"freemarker-module","moduleDir":"freemarker-module"},"pug-module":{"active":false,"id":"pug-module","moduleDir":"pug-module"},"search-module":{"active":false,"id":"search-module","moduleDir":"search-module"},"pebble-module":{"active":true,"id":"pebble-module","moduleDir":"pebble-module"},"seo-module":{"active":false,"id":"seo-module","moduleDir":"seo-module"},"example-module":{"active":false,"id":"example-module","moduleDir":"example-module"},"markedjs-module":{"active":true,"id":"markedjs-module","moduleDir":"markedjs-module"}}} |
Binary file modified
BIN
+0 Bytes
(100%)
cms-server/modules/example-module/libs/example-module-2.14.0.jar
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
id=seo-module | ||
name=seo module | ||
version=2.14.0 | ||
priority=HIGH |
63 changes: 63 additions & 0 deletions
63
modules/seo-module/src/main/java/com/github/thmarx/cms/modules/example/SitemapGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.github.thmarx.cms.modules.example; | ||
|
||
/*- | ||
* #%L | ||
* seo-module | ||
* %% | ||
* Copyright (C) 2023 Marx-Software | ||
* %% | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public | ||
* License along with this program. If not, see | ||
* <http://www.gnu.org/licenses/gpl-3.0.html>. | ||
* #L% | ||
*/ | ||
|
||
import com.github.thmarx.cms.api.SiteProperties; | ||
import com.github.thmarx.cms.api.db.ContentNode; | ||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
import java.nio.charset.StandardCharsets; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
/** | ||
* | ||
* @author t.marx | ||
*/ | ||
@RequiredArgsConstructor | ||
public class SitemapGenerator implements AutoCloseable { | ||
|
||
private final OutputStream output; | ||
private final SiteProperties siteProperties; | ||
|
||
|
||
public void start () throws IOException { | ||
output.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>".getBytes(StandardCharsets.UTF_8)); | ||
output.write("<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">".getBytes(StandardCharsets.UTF_8)); | ||
} | ||
|
||
public void addNode (final ContentNode node) throws IOException { | ||
output.write("<url>".getBytes(StandardCharsets.UTF_8)); | ||
output.write("<loc>%s/%s</loc>".formatted( | ||
siteProperties.getOrDefault("baseurl", ""), | ||
node.uri() | ||
).getBytes(StandardCharsets.UTF_8)); | ||
output.write("<lastmod></lastmod>".getBytes(StandardCharsets.UTF_8)); | ||
output.write("</url>".getBytes(StandardCharsets.UTF_8)); | ||
} | ||
|
||
@Override | ||
public void close() throws Exception { | ||
output.write("</urlset>".getBytes(StandardCharsets.UTF_8)); | ||
output.close(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters