20 Commits

Author SHA1 Message Date
Javi Martín
d464be1d7a Don't ping search engines after sitemap generation
The Bing sitemap submission was removed in sitemap_generator 6.3.0 [1],
and Google has also deprecated the ping and we're getting an error when
deploying:

```
Ping failed for Google: #<OpenURI::HTTPError: 404 Sitemaps ping is
deprecated.
```

Since those were the only two search engines we were pinging in the
past, we're removing the code that did so.

[1] Pull request 408 in https://github.com/kjvarga/sitemap_generator
2024-04-01 05:19:48 +02:00
Javi Martín
edd47877c2 Extract methods to get tenant subfolder/file paths
We were using the same logic in many different places, so we're
simplifying the code. I'm not convinced about the method names, though,
so we might change them in the future.

Note using this method for the default tenant in the `TenantDiskService`
class resulted in a `//` in the path, which is probably harmless but
very ugly and it also generates a different key than the one we got
until now. I've added an extra test to make sure that isn't the case.
2022-11-11 01:41:14 +01:00
Javi Martín
5100884110 Generate one sitemap per tenant
Note that the `sitemap:refresh` task only pings search engines at the
end, so it only does so for the `Sitemap.default_host` defined last. So
we're using the `sitemap:refresh:no_ping` task instead and pinging
search engines after creating each sitemap.

Note we're pinging search engines in staging and preproduction
environments. I'm leaving it that way because that's what we've done
until now, but I wonder whether we should only do so on production.

Since we're creating a new method to get the current url_options, we're
also using it in the dev_seeds.
2022-11-09 18:19:20 +01:00
Javi Martín
f871658510 Use default_url_options to generate absolute URLs
In the dev seeds, we were using `Setting["url"]/proposals`, but we can
use `proposals_url` instead, similar to what we do in the rest of the
application.

We can do a similar thing in the sitemap. This way the sitemap will also
work on installations who haven't manually set the "url" setting.

Since we aren't using `Setting["url"]` anywhere anymore, we're removing
it.

This setting was mainly redundant, since we already had the
`server_name` in the secrets. Furthermore, `server_name` is
automatically configured when running the installer, while
`Setting["url"]` had to be manually set in the admin section the
application was installed.

Note we're using `ActionMailer::Base` setting to generate URLs. Sounds a
bit strange, but it's a standard way Rails provides to generate URLs
outside the context of a request.
2022-10-02 16:54:06 +02:00
Javi Martín
bbc3c2d7e7 Add and apply Style/SingleLineMethods rubocop rule
Single line methods are hard to read, at least with this syntax. The
syntax used in Ruby 3.0 is accepted since Rubocop 1.7.0.
2021-09-03 11:49:53 +02:00
Julian Herrero
6e00842b0e Don't include disabled processes in sitemap 2019-12-19 13:26:29 +07:00
Javi Martín
db97f9d08c Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules.

Personally I prefer no empty lines around blocks, clases, etc... as
recommended by the Ruby style guide [1], and they're the default values
in rubocop, so those are the settings I'm applying.

The exception is the `private` access modifier, since we were leaving
empty lines around it most of the time. That's the default rubocop rule
as well. Personally I don't have a strong preference about this one.


[1] https://rubystyle.guide/#empty-lines-around-bodies
2019-10-24 17:11:47 +02:00
Julian Herrero
c9cdc72537 Use double quotes in config/ 2019-03-15 10:29:07 +01:00
decabeza
04e3bf5797 Removes references to deleted general terms page 2018-12-04 17:25:34 +01:00
Bertocq
23b15490ce Remove sitemap generator output when running specs
When running tests there is no need to pollute rspec's output with any
kind of log/info.
2018-04-14 22:26:03 +02:00
decabeza
286371c9d9 Changes more_info folder and path to help 2018-01-30 18:26:30 +01:00
Bertocq
3509bfe3e4 Remove spending proposals from sitemap and its test, deprecated model 2018-01-07 15:38:44 +01:00
decabeza
ef5cbc4638 adds legislation processes to sitemap 2017-12-21 14:44:30 +01:00
decabeza
466b6d9ec5 removes irrelevants pages from sitemap 2017-12-21 14:19:05 +01:00
decabeza
c846107cd8 removes more info pages belongs to madrid's fork 2017-06-07 18:28:12 +02:00
Alberto Garcia Cabeza
078d8da30d changes page paths on sitemap.rb 2017-04-27 16:37:41 +02:00
Alberto Garcia Cabeza
f7020618da adds pages, budgets and polls to sitemap.rb 2017-04-21 20:08:46 +02:00
Julian Herrero
9a2b049ec8 take default host from settings 2016-12-03 12:19:58 +01:00
Julian Herrero
3940165642 don't compress the sitemap 2016-12-02 11:29:35 +01:00
Julian Herrero
bb61d73c04 add sitemap generator 2016-12-02 11:28:39 +01:00